AWS Greengrass

2018/03/29 - AWS Greengrass - 6 updated api methods

Changes  Greengrass APIs now support creating Machine Learning resource types and configuring binary data as the input payload for Greengrass Lambda functions.

CreateFunctionDefinition (updated) Link ¶
Changes (request)
{'InitialVersion': {'Functions': {'FunctionConfiguration': {'EncodingType': 'binary '
                                                                            '| '
                                                                            'json'}}}}

Creates a Lambda function definition which contains a list of Lambda functions and their configurations to be used in a group. You can create an initial version of the definition by providing a list of Lambda functions and their configurations now, or use ''CreateFunctionDefinitionVersion'' later.

See also: AWS API Documentation

Request Syntax

client.create_function_definition(
    AmznClientToken='string',
    InitialVersion={
        'Functions': [
            {
                'FunctionArn': 'string',
                'FunctionConfiguration': {
                    'EncodingType': 'binary'|'json',
                    'Environment': {
                        'AccessSysfs': True|False,
                        'ResourceAccessPolicies': [
                            {
                                'Permission': 'ro'|'rw',
                                'ResourceId': 'string'
                            },
                        ],
                        'Variables': {
                            'string': 'string'
                        }
                    },
                    'ExecArgs': 'string',
                    'Executable': 'string',
                    'MemorySize': 123,
                    'Pinned': True|False,
                    'Timeout': 123
                },
                'Id': 'string'
            },
        ]
    },
    Name='string'
)
type AmznClientToken

string

param AmznClientToken

A client token used to correlate requests and responses.

type InitialVersion

dict

param InitialVersion

Information about the initial version of the function definition.

  • Functions (list) -- A list of Lambda functions in this function definition version.

    • (dict) -- Information about a Lambda function.

      • FunctionArn (string) -- The ARN of the Lambda function.

      • FunctionConfiguration (dict) -- The configuration of the Lambda function.

        • EncodingType (string) -- The expected encoding type of the input payload for the function. The default is ''json''.

        • Environment (dict) -- The environment configuration of the function.

          • AccessSysfs (boolean) -- If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda function needs to read device information from /sys.

          • ResourceAccessPolicies (list) -- A list of the resources, with their permissions, to which the Lambda function will be granted access. A Lambda function can have at most 10 resources.

            • (dict) -- A policy used by the function to access a resource.

              • Permission (string) -- The permissions that the Lambda function has to the resource. Can be one of ''rw'' (read/write) or ''ro'' (read-only).

              • ResourceId (string) -- The ID of the resource. (This ID is assigned to the resource when you create the resource definiton.)

          • Variables (dict) -- Environment variables for the Lambda function's configuration.

            • (string) --

              • (string) --

        • ExecArgs (string) -- The execution arguments.

        • Executable (string) -- The name of the function executable.

        • MemorySize (integer) -- The memory size, in KB, which the function requires.

        • Pinned (boolean) -- True if the function is pinned. Pinned means the function is long-lived and starts when the core starts.

        • Timeout (integer) -- The allowed function execution time, after which Lambda should terminate the function. This timeout still applies to pinned lambdas for each request.

      • Id (string) -- The ID of the Lambda function.

type Name

string

param Name

The name of the function definition.

rtype

dict

returns

Response Syntax

{
    'Arn': 'string',
    'CreationTimestamp': 'string',
    'Id': 'string',
    'LastUpdatedTimestamp': 'string',
    'LatestVersion': 'string',
    'LatestVersionArn': 'string',
    'Name': 'string'
}

Response Structure

  • (dict) --

    • Arn (string) -- The ARN of the definition.

    • CreationTimestamp (string) -- The time, in milliseconds since the epoch, when the definition was created.

    • Id (string) -- The ID of the definition.

    • LastUpdatedTimestamp (string) -- The time, in milliseconds since the epoch, when the definition was last updated.

    • LatestVersion (string) -- The latest version of the definition.

    • LatestVersionArn (string) -- The ARN of the latest version of the definition.

    • Name (string) -- The name of the definition.

CreateFunctionDefinitionVersion (updated) Link ¶
Changes (request)
{'Functions': {'FunctionConfiguration': {'EncodingType': 'binary | json'}}}

Creates a version of a Lambda function definition that has already been defined.

See also: AWS API Documentation

Request Syntax

client.create_function_definition_version(
    AmznClientToken='string',
    FunctionDefinitionId='string',
    Functions=[
        {
            'FunctionArn': 'string',
            'FunctionConfiguration': {
                'EncodingType': 'binary'|'json',
                'Environment': {
                    'AccessSysfs': True|False,
                    'ResourceAccessPolicies': [
                        {
                            'Permission': 'ro'|'rw',
                            'ResourceId': 'string'
                        },
                    ],
                    'Variables': {
                        'string': 'string'
                    }
                },
                'ExecArgs': 'string',
                'Executable': 'string',
                'MemorySize': 123,
                'Pinned': True|False,
                'Timeout': 123
            },
            'Id': 'string'
        },
    ]
)
type AmznClientToken

string

param AmznClientToken

A client token used to correlate requests and responses.

type FunctionDefinitionId

string

param FunctionDefinitionId

[REQUIRED] The ID of the Lambda function definition.

type Functions

list

param Functions

A list of Lambda functions in this function definition version.

  • (dict) -- Information about a Lambda function.

    • FunctionArn (string) -- The ARN of the Lambda function.

    • FunctionConfiguration (dict) -- The configuration of the Lambda function.

      • EncodingType (string) -- The expected encoding type of the input payload for the function. The default is ''json''.

      • Environment (dict) -- The environment configuration of the function.

        • AccessSysfs (boolean) -- If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda function needs to read device information from /sys.

        • ResourceAccessPolicies (list) -- A list of the resources, with their permissions, to which the Lambda function will be granted access. A Lambda function can have at most 10 resources.

          • (dict) -- A policy used by the function to access a resource.

            • Permission (string) -- The permissions that the Lambda function has to the resource. Can be one of ''rw'' (read/write) or ''ro'' (read-only).

            • ResourceId (string) -- The ID of the resource. (This ID is assigned to the resource when you create the resource definiton.)

        • Variables (dict) -- Environment variables for the Lambda function's configuration.

          • (string) --

            • (string) --

      • ExecArgs (string) -- The execution arguments.

      • Executable (string) -- The name of the function executable.

      • MemorySize (integer) -- The memory size, in KB, which the function requires.

      • Pinned (boolean) -- True if the function is pinned. Pinned means the function is long-lived and starts when the core starts.

      • Timeout (integer) -- The allowed function execution time, after which Lambda should terminate the function. This timeout still applies to pinned lambdas for each request.

    • Id (string) -- The ID of the Lambda function.

rtype

dict

returns

Response Syntax

{
    'Arn': 'string',
    'CreationTimestamp': 'string',
    'Id': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) --

    • Arn (string) -- The ARN of the version.

    • CreationTimestamp (string) -- The time, in milliseconds since the epoch, when the version was created.

    • Id (string) -- The ID of the version.

    • Version (string) -- The unique ID of the version.

CreateResourceDefinition (updated) Link ¶
Changes (request)
{'InitialVersion': {'Resources': {'ResourceDataContainer': {'S3MachineLearningModelResourceData': {'DestinationPath': 'string',
                                                                                                   'S3Uri': 'string'},
                                                            'SageMakerMachineLearningModelResourceData': {'DestinationPath': 'string',
                                                                                                          'SageMakerJobArn': 'string'}}}}}

Creates a resource definition which contains a list of resources to be used in a group. You can create an initial version of the definition by providing a list of resources now, or use ''CreateResourceDefinitionVersion'' later.

See also: AWS API Documentation

Request Syntax

client.create_resource_definition(
    AmznClientToken='string',
    InitialVersion={
        'Resources': [
            {
                'Id': 'string',
                'Name': 'string',
                'ResourceDataContainer': {
                    'LocalDeviceResourceData': {
                        'GroupOwnerSetting': {
                            'AutoAddGroupOwner': True|False,
                            'GroupOwner': 'string'
                        },
                        'SourcePath': 'string'
                    },
                    'LocalVolumeResourceData': {
                        'DestinationPath': 'string',
                        'GroupOwnerSetting': {
                            'AutoAddGroupOwner': True|False,
                            'GroupOwner': 'string'
                        },
                        'SourcePath': 'string'
                    },
                    'S3MachineLearningModelResourceData': {
                        'DestinationPath': 'string',
                        'S3Uri': 'string'
                    },
                    'SageMakerMachineLearningModelResourceData': {
                        'DestinationPath': 'string',
                        'SageMakerJobArn': 'string'
                    }
                }
            },
        ]
    },
    Name='string'
)
type AmznClientToken

string

param AmznClientToken

A client token used to correlate requests and responses.

type InitialVersion

dict

param InitialVersion

Information about the initial version of the resource definition.

  • Resources (list) -- A list of resources.

    • (dict) -- Information about a resource.

      • Id (string) -- The resource ID, used to refer to a resource in the Lambda function configuration. Max length is 128 characters with pattern ''[a-zA-Z0-9:_-]+''. This must be unique within a Greengrass group.

      • Name (string) -- The descriptive resource name, which is displayed on the Greengrass console. Max length 128 characters with pattern ''[a-zA-Z0-9:_-]+''. This must be unique within a Greengrass group.

      • ResourceDataContainer (dict) -- A container of data for all resource types.

        • LocalDeviceResourceData (dict) -- Attributes that define the local device resource.

          • GroupOwnerSetting (dict) -- Group/owner related settings for local resources.

            • AutoAddGroupOwner (boolean) -- If true, GreenGrass automatically adds the specified Linux OS group owner of the resource to the Lambda process privileges. Thus the Lambda process will have the file access permissions of the added Linux group.

            • GroupOwner (string) -- The name of the Linux OS group whose privileges will be added to the Lambda process. This field is optional.

          • SourcePath (string) -- The local absolute path of the device resource. The source path for a device resource can refer only to a character device or block device under ''/dev''.

        • LocalVolumeResourceData (dict) -- Attributes that define the local volume resource.

          • DestinationPath (string) -- The absolute local path of the resource inside the lambda environment.

          • GroupOwnerSetting (dict) -- Allows you to configure additional group privileges for the Lambda process. This field is optional.

            • AutoAddGroupOwner (boolean) -- If true, GreenGrass automatically adds the specified Linux OS group owner of the resource to the Lambda process privileges. Thus the Lambda process will have the file access permissions of the added Linux group.

            • GroupOwner (string) -- The name of the Linux OS group whose privileges will be added to the Lambda process. This field is optional.

          • SourcePath (string) -- The local absolute path of the volume resource on the host. The source path for a volume resource type cannot start with ''/proc'' or ''/sys''.

        • S3MachineLearningModelResourceData (dict) -- Attributes that define an S3 machine learning resource.

          • DestinationPath (string) -- The absolute local path of the resource inside the Lambda environment.

          • S3Uri (string) -- The URI of the source model in an S3 bucket. The model package must be in tar.gz or .zip format.

        • SageMakerMachineLearningModelResourceData (dict) -- Attributes that define an SageMaker machine learning resource.

          • DestinationPath (string) -- The absolute local path of the resource inside the Lambda environment.

          • SageMakerJobArn (string) -- The ARN of the SageMaker training job that represents the source model.

type Name

string

param Name

The name of the resource definition.

rtype

dict

returns

Response Syntax

{
    'Arn': 'string',
    'CreationTimestamp': 'string',
    'Id': 'string',
    'LastUpdatedTimestamp': 'string',
    'LatestVersion': 'string',
    'LatestVersionArn': 'string',
    'Name': 'string'
}

Response Structure

  • (dict) --

    • Arn (string) -- The ARN of the definition.

    • CreationTimestamp (string) -- The time, in milliseconds since the epoch, when the definition was created.

    • Id (string) -- The ID of the definition.

    • LastUpdatedTimestamp (string) -- The time, in milliseconds since the epoch, when the definition was last updated.

    • LatestVersion (string) -- The latest version of the definition.

    • LatestVersionArn (string) -- The ARN of the latest version of the definition.

    • Name (string) -- The name of the definition.

CreateResourceDefinitionVersion (updated) Link ¶
Changes (request)
{'Resources': {'ResourceDataContainer': {'S3MachineLearningModelResourceData': {'DestinationPath': 'string',
                                                                                'S3Uri': 'string'},
                                         'SageMakerMachineLearningModelResourceData': {'DestinationPath': 'string',
                                                                                       'SageMakerJobArn': 'string'}}}}

Creates a version of a resource definition that has already been defined.

See also: AWS API Documentation

Request Syntax

client.create_resource_definition_version(
    AmznClientToken='string',
    ResourceDefinitionId='string',
    Resources=[
        {
            'Id': 'string',
            'Name': 'string',
            'ResourceDataContainer': {
                'LocalDeviceResourceData': {
                    'GroupOwnerSetting': {
                        'AutoAddGroupOwner': True|False,
                        'GroupOwner': 'string'
                    },
                    'SourcePath': 'string'
                },
                'LocalVolumeResourceData': {
                    'DestinationPath': 'string',
                    'GroupOwnerSetting': {
                        'AutoAddGroupOwner': True|False,
                        'GroupOwner': 'string'
                    },
                    'SourcePath': 'string'
                },
                'S3MachineLearningModelResourceData': {
                    'DestinationPath': 'string',
                    'S3Uri': 'string'
                },
                'SageMakerMachineLearningModelResourceData': {
                    'DestinationPath': 'string',
                    'SageMakerJobArn': 'string'
                }
            }
        },
    ]
)
type AmznClientToken

string

param AmznClientToken

A client token used to correlate requests and responses.

type ResourceDefinitionId

string

param ResourceDefinitionId

[REQUIRED] The ID of the resource definition.

type Resources

list

param Resources

A list of resources.

  • (dict) -- Information about a resource.

    • Id (string) -- The resource ID, used to refer to a resource in the Lambda function configuration. Max length is 128 characters with pattern ''[a-zA-Z0-9:_-]+''. This must be unique within a Greengrass group.

    • Name (string) -- The descriptive resource name, which is displayed on the Greengrass console. Max length 128 characters with pattern ''[a-zA-Z0-9:_-]+''. This must be unique within a Greengrass group.

    • ResourceDataContainer (dict) -- A container of data for all resource types.

      • LocalDeviceResourceData (dict) -- Attributes that define the local device resource.

        • GroupOwnerSetting (dict) -- Group/owner related settings for local resources.

          • AutoAddGroupOwner (boolean) -- If true, GreenGrass automatically adds the specified Linux OS group owner of the resource to the Lambda process privileges. Thus the Lambda process will have the file access permissions of the added Linux group.

          • GroupOwner (string) -- The name of the Linux OS group whose privileges will be added to the Lambda process. This field is optional.

        • SourcePath (string) -- The local absolute path of the device resource. The source path for a device resource can refer only to a character device or block device under ''/dev''.

      • LocalVolumeResourceData (dict) -- Attributes that define the local volume resource.

        • DestinationPath (string) -- The absolute local path of the resource inside the lambda environment.

        • GroupOwnerSetting (dict) -- Allows you to configure additional group privileges for the Lambda process. This field is optional.

          • AutoAddGroupOwner (boolean) -- If true, GreenGrass automatically adds the specified Linux OS group owner of the resource to the Lambda process privileges. Thus the Lambda process will have the file access permissions of the added Linux group.

          • GroupOwner (string) -- The name of the Linux OS group whose privileges will be added to the Lambda process. This field is optional.

        • SourcePath (string) -- The local absolute path of the volume resource on the host. The source path for a volume resource type cannot start with ''/proc'' or ''/sys''.

      • S3MachineLearningModelResourceData (dict) -- Attributes that define an S3 machine learning resource.

        • DestinationPath (string) -- The absolute local path of the resource inside the Lambda environment.

        • S3Uri (string) -- The URI of the source model in an S3 bucket. The model package must be in tar.gz or .zip format.

      • SageMakerMachineLearningModelResourceData (dict) -- Attributes that define an SageMaker machine learning resource.

        • DestinationPath (string) -- The absolute local path of the resource inside the Lambda environment.

        • SageMakerJobArn (string) -- The ARN of the SageMaker training job that represents the source model.

rtype

dict

returns

Response Syntax

{
    'Arn': 'string',
    'CreationTimestamp': 'string',
    'Id': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) --

    • Arn (string) -- The ARN of the version.

    • CreationTimestamp (string) -- The time, in milliseconds since the epoch, when the version was created.

    • Id (string) -- The ID of the version.

    • Version (string) -- The unique ID of the version.

GetFunctionDefinitionVersion (updated) Link ¶
Changes (response)
{'Definition': {'Functions': {'FunctionConfiguration': {'EncodingType': 'binary '
                                                                        '| '
                                                                        'json'}}}}

Retrieves information about a Lambda function definition version, including which Lambda functions are included in the version and their configurations.

See also: AWS API Documentation

Request Syntax

client.get_function_definition_version(
    FunctionDefinitionId='string',
    FunctionDefinitionVersionId='string'
)
type FunctionDefinitionId

string

param FunctionDefinitionId

[REQUIRED] The ID of the Lambda function definition.

type FunctionDefinitionVersionId

string

param FunctionDefinitionVersionId

[REQUIRED] The ID of the function definition version.

rtype

dict

returns

Response Syntax

{
    'Arn': 'string',
    'CreationTimestamp': 'string',
    'Definition': {
        'Functions': [
            {
                'FunctionArn': 'string',
                'FunctionConfiguration': {
                    'EncodingType': 'binary'|'json',
                    'Environment': {
                        'AccessSysfs': True|False,
                        'ResourceAccessPolicies': [
                            {
                                'Permission': 'ro'|'rw',
                                'ResourceId': 'string'
                            },
                        ],
                        'Variables': {
                            'string': 'string'
                        }
                    },
                    'ExecArgs': 'string',
                    'Executable': 'string',
                    'MemorySize': 123,
                    'Pinned': True|False,
                    'Timeout': 123
                },
                'Id': 'string'
            },
        ]
    },
    'Id': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) -- success

    • Arn (string) -- The ARN of the function definition version.

    • CreationTimestamp (string) -- The time, in milliseconds since the epoch, when the function definition version was created.

    • Definition (dict) -- Information on the definition.

      • Functions (list) -- A list of Lambda functions in this function definition version.

        • (dict) -- Information about a Lambda function.

          • FunctionArn (string) -- The ARN of the Lambda function.

          • FunctionConfiguration (dict) -- The configuration of the Lambda function.

            • EncodingType (string) -- The expected encoding type of the input payload for the function. The default is ''json''.

            • Environment (dict) -- The environment configuration of the function.

              • AccessSysfs (boolean) -- If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda function needs to read device information from /sys.

              • ResourceAccessPolicies (list) -- A list of the resources, with their permissions, to which the Lambda function will be granted access. A Lambda function can have at most 10 resources.

                • (dict) -- A policy used by the function to access a resource.

                  • Permission (string) -- The permissions that the Lambda function has to the resource. Can be one of ''rw'' (read/write) or ''ro'' (read-only).

                  • ResourceId (string) -- The ID of the resource. (This ID is assigned to the resource when you create the resource definiton.)

              • Variables (dict) -- Environment variables for the Lambda function's configuration.

                • (string) --

                  • (string) --

            • ExecArgs (string) -- The execution arguments.

            • Executable (string) -- The name of the function executable.

            • MemorySize (integer) -- The memory size, in KB, which the function requires.

            • Pinned (boolean) -- True if the function is pinned. Pinned means the function is long-lived and starts when the core starts.

            • Timeout (integer) -- The allowed function execution time, after which Lambda should terminate the function. This timeout still applies to pinned lambdas for each request.

          • Id (string) -- The ID of the Lambda function.

    • Id (string) -- The ID of the function definition version.

    • Version (string) -- The version of the function definition version.

GetResourceDefinitionVersion (updated) Link ¶
Changes (response)
{'Definition': {'Resources': {'ResourceDataContainer': {'S3MachineLearningModelResourceData': {'DestinationPath': 'string',
                                                                                               'S3Uri': 'string'},
                                                        'SageMakerMachineLearningModelResourceData': {'DestinationPath': 'string',
                                                                                                      'SageMakerJobArn': 'string'}}}}}

Retrieves information about a resource definition version, including which resources are included in the version.

See also: AWS API Documentation

Request Syntax

client.get_resource_definition_version(
    ResourceDefinitionId='string',
    ResourceDefinitionVersionId='string'
)
type ResourceDefinitionId

string

param ResourceDefinitionId

[REQUIRED] The ID of the resource definition.

type ResourceDefinitionVersionId

string

param ResourceDefinitionVersionId

[REQUIRED] The ID of the resource definition version.

rtype

dict

returns

Response Syntax

{
    'Arn': 'string',
    'CreationTimestamp': 'string',
    'Definition': {
        'Resources': [
            {
                'Id': 'string',
                'Name': 'string',
                'ResourceDataContainer': {
                    'LocalDeviceResourceData': {
                        'GroupOwnerSetting': {
                            'AutoAddGroupOwner': True|False,
                            'GroupOwner': 'string'
                        },
                        'SourcePath': 'string'
                    },
                    'LocalVolumeResourceData': {
                        'DestinationPath': 'string',
                        'GroupOwnerSetting': {
                            'AutoAddGroupOwner': True|False,
                            'GroupOwner': 'string'
                        },
                        'SourcePath': 'string'
                    },
                    'S3MachineLearningModelResourceData': {
                        'DestinationPath': 'string',
                        'S3Uri': 'string'
                    },
                    'SageMakerMachineLearningModelResourceData': {
                        'DestinationPath': 'string',
                        'SageMakerJobArn': 'string'
                    }
                }
            },
        ]
    },
    'Id': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) -- success

    • Arn (string) -- Arn of the resource definition version.

    • CreationTimestamp (string) -- The time, in milliseconds since the epoch, when the resource definition version was created.

    • Definition (dict) -- Information about the definition.

      • Resources (list) -- A list of resources.

        • (dict) -- Information about a resource.

          • Id (string) -- The resource ID, used to refer to a resource in the Lambda function configuration. Max length is 128 characters with pattern ''[a-zA-Z0-9:_-]+''. This must be unique within a Greengrass group.

          • Name (string) -- The descriptive resource name, which is displayed on the Greengrass console. Max length 128 characters with pattern ''[a-zA-Z0-9:_-]+''. This must be unique within a Greengrass group.

          • ResourceDataContainer (dict) -- A container of data for all resource types.

            • LocalDeviceResourceData (dict) -- Attributes that define the local device resource.

              • GroupOwnerSetting (dict) -- Group/owner related settings for local resources.

                • AutoAddGroupOwner (boolean) -- If true, GreenGrass automatically adds the specified Linux OS group owner of the resource to the Lambda process privileges. Thus the Lambda process will have the file access permissions of the added Linux group.

                • GroupOwner (string) -- The name of the Linux OS group whose privileges will be added to the Lambda process. This field is optional.

              • SourcePath (string) -- The local absolute path of the device resource. The source path for a device resource can refer only to a character device or block device under ''/dev''.

            • LocalVolumeResourceData (dict) -- Attributes that define the local volume resource.

              • DestinationPath (string) -- The absolute local path of the resource inside the lambda environment.

              • GroupOwnerSetting (dict) -- Allows you to configure additional group privileges for the Lambda process. This field is optional.

                • AutoAddGroupOwner (boolean) -- If true, GreenGrass automatically adds the specified Linux OS group owner of the resource to the Lambda process privileges. Thus the Lambda process will have the file access permissions of the added Linux group.

                • GroupOwner (string) -- The name of the Linux OS group whose privileges will be added to the Lambda process. This field is optional.

              • SourcePath (string) -- The local absolute path of the volume resource on the host. The source path for a volume resource type cannot start with ''/proc'' or ''/sys''.

            • S3MachineLearningModelResourceData (dict) -- Attributes that define an S3 machine learning resource.

              • DestinationPath (string) -- The absolute local path of the resource inside the Lambda environment.

              • S3Uri (string) -- The URI of the source model in an S3 bucket. The model package must be in tar.gz or .zip format.

            • SageMakerMachineLearningModelResourceData (dict) -- Attributes that define an SageMaker machine learning resource.

              • DestinationPath (string) -- The absolute local path of the resource inside the Lambda environment.

              • SageMakerJobArn (string) -- The ARN of the SageMaker training job that represents the source model.

    • Id (string) -- The ID of the resource definition version.

    • Version (string) -- The version of the resource definition version.