AWS IoT Greengrass V2

2022/05/18 - AWS IoT Greengrass V2 - 1 new3 updated api methods

Changes  This release adds the new DeleteDeployment API operation that you can use to delete deployment resources. This release also adds support for discontinued AWS-provided components, so AWS can communicate when a component has any issues that you should consider before you deploy it.

DeleteDeployment (new) Link ¶

Deletes a deployment. To delete an active deployment, you must first cancel it. For more information, see CancelDeployment.

Deleting a deployment doesn't affect core devices that run that deployment, because core devices store the deployment's configuration on the device. Additionally, core devices can roll back to a previous deployment that has been deleted.

See also: AWS API Documentation

Request Syntax

client.delete_deployment(
    deploymentId='string'
)
type deploymentId:

string

param deploymentId:

[REQUIRED]

The ID of the deployment.

returns:

None

CreateComponentVersion (updated) Link ¶
Changes (response)
{'status': {'vendorGuidance': 'ACTIVE | DISCONTINUED | DELETED',
            'vendorGuidanceMessage': 'string'}}

Creates a component. Components are software that run on Greengrass core devices. After you develop and test a component on your core device, you can use this operation to upload your component to IoT Greengrass. Then, you can deploy the component to other core devices.

You can use this operation to do the following:

  • Create components from recipes Create a component from a recipe, which is a file that defines the component's metadata, parameters, dependencies, lifecycle, artifacts, and platform capability. For more information, see IoT Greengrass component recipe reference in the IoT Greengrass V2 Developer Guide. To create a component from a recipe, specify inlineRecipe when you call this operation.

  • Create components from Lambda functions Create a component from an Lambda function that runs on IoT Greengrass. This creates a recipe and artifacts from the Lambda function's deployment package. You can use this operation to migrate Lambda functions from IoT Greengrass V1 to IoT Greengrass V2. This function only accepts Lambda functions that use the following runtimes:

    • Python 2.7 – python2.7

    • Python 3.7 – python3.7

    • Python 3.8 – python3.8

    • Python 3.9 – python3.9

    • Java 8 – java8

    • Java 11 – java11

    • Node.js 10 – nodejs10.x

    • Node.js 12 – nodejs12.x

    • Node.js 14 – nodejs14.x

To create a component from a Lambda function, specify lambdaFunction when you call this operation.

See also: AWS API Documentation

Request Syntax

client.create_component_version(
    inlineRecipe=b'bytes',
    lambdaFunction={
        'lambdaArn': 'string',
        'componentName': 'string',
        'componentVersion': 'string',
        'componentPlatforms': [
            {
                'name': 'string',
                'attributes': {
                    'string': 'string'
                }
            },
        ],
        'componentDependencies': {
            'string': {
                'versionRequirement': 'string',
                'dependencyType': 'HARD'|'SOFT'
            }
        },
        'componentLambdaParameters': {
            'eventSources': [
                {
                    'topic': 'string',
                    'type': 'PUB_SUB'|'IOT_CORE'
                },
            ],
            'maxQueueSize': 123,
            'maxInstancesCount': 123,
            'maxIdleTimeInSeconds': 123,
            'timeoutInSeconds': 123,
            'statusTimeoutInSeconds': 123,
            'pinned': True|False,
            'inputPayloadEncodingType': 'json'|'binary',
            'execArgs': [
                'string',
            ],
            'environmentVariables': {
                'string': 'string'
            },
            'linuxProcessParams': {
                'isolationMode': 'GreengrassContainer'|'NoContainer',
                'containerParams': {
                    'memorySizeInKB': 123,
                    'mountROSysfs': True|False,
                    'volumes': [
                        {
                            'sourcePath': 'string',
                            'destinationPath': 'string',
                            'permission': 'ro'|'rw',
                            'addGroupOwner': True|False
                        },
                    ],
                    'devices': [
                        {
                            'path': 'string',
                            'permission': 'ro'|'rw',
                            'addGroupOwner': True|False
                        },
                    ]
                }
            }
        }
    },
    tags={
        'string': 'string'
    },
    clientToken='string'
)
type inlineRecipe:

bytes

param inlineRecipe:

The recipe to use to create the component. The recipe defines the component's metadata, parameters, dependencies, lifecycle, artifacts, and platform compatibility.

You must specify either inlineRecipe or lambdaFunction.

type lambdaFunction:

dict

param lambdaFunction:

The parameters to create a component from a Lambda function.

You must specify either inlineRecipe or lambdaFunction.

  • lambdaArn (string) -- [REQUIRED]

    The ARN of the Lambda function. The ARN must include the version of the function to import. You can't use version aliases like $LATEST.

  • componentName (string) --

    The name of the component.

    Defaults to the name of the Lambda function.

  • componentVersion (string) --

    The version of the component.

    Defaults to the version of the Lambda function as a semantic version. For example, if your function version is 3, the component version becomes 3.0.0.

  • componentPlatforms (list) --

    The platforms that the component version supports.

    • (dict) --

      Contains information about a platform that a component supports.

      • name (string) --

        The friendly name of the platform. This name helps you identify the platform.

        If you omit this parameter, IoT Greengrass creates a friendly name from the os and architecture of the platform.

      • attributes (dict) --

        A dictionary of attributes for the platform. The IoT Greengrass Core software defines the os and platform by default. You can specify additional platform attributes for a core device when you deploy the Greengrass nucleus component. For more information, see the Greengrass nucleus component in the IoT Greengrass V2 Developer Guide.

        • (string) --

          • (string) --

  • componentDependencies (dict) --

    The component versions on which this Lambda function component depends.

    • (string) --

      • (dict) --

        Contains information about a component dependency for a Lambda function component.

        • versionRequirement (string) --

          The component version requirement for the component dependency.

          IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning.

        • dependencyType (string) --

          The type of this dependency. Choose from the following options:

          • SOFT – The component doesn't restart if the dependency changes state.

          • HARD – The component restarts if the dependency changes state.

          Default: HARD

  • componentLambdaParameters (dict) --

    The system and runtime parameters for the Lambda function as it runs on the Greengrass core device.

    • eventSources (list) --

      The list of event sources to which to subscribe to receive work messages. The Lambda function runs when it receives a message from an event source. You can subscribe this function to local publish/subscribe messages and Amazon Web Services IoT Core MQTT messages.

      • (dict) --

        Contains information about an event source for an Lambda function. The event source defines the topics on which this Lambda function subscribes to receive messages that run the function.

        • topic (string) -- [REQUIRED]

          The topic to which to subscribe to receive event messages.

        • type (string) -- [REQUIRED]

          The type of event source. Choose from the following options:

          • PUB_SUB – Subscribe to local publish/subscribe messages. This event source type doesn't support MQTT wildcards ( + and #) in the event source topic.

          • IOT_CORE – Subscribe to Amazon Web Services IoT Core MQTT messages. This event source type supports MQTT wildcards ( + and #) in the event source topic.

    • maxQueueSize (integer) --

      The maximum size of the message queue for the Lambda function component. The IoT Greengrass core stores messages in a FIFO (first-in-first-out) queue until it can run the Lambda function to consume each message.

    • maxInstancesCount (integer) --

      The maximum number of instances that a non-pinned Lambda function can run at the same time.

    • maxIdleTimeInSeconds (integer) --

      The maximum amount of time in seconds that a non-pinned Lambda function can idle before the IoT Greengrass Core software stops its process.

    • timeoutInSeconds (integer) --

      The maximum amount of time in seconds that the Lambda function can process a work item.

    • statusTimeoutInSeconds (integer) --

      The interval in seconds at which a pinned (also known as long-lived) Lambda function component sends status updates to the Lambda manager component.

    • pinned (boolean) --

      Whether or not the Lambda function is pinned, or long-lived.

      • A pinned Lambda function starts when IoT Greengrass starts and keeps running in its own container.

      • A non-pinned Lambda function starts only when it receives a work item and exists after it idles for maxIdleTimeInSeconds. If the function has multiple work items, the IoT Greengrass Core software creates multiple instances of the function.

      Default: true

    • inputPayloadEncodingType (string) --

      The encoding type that the Lambda function supports.

      Default: json

    • execArgs (list) --

      The list of arguments to pass to the Lambda function when it runs.

      • (string) --

    • environmentVariables (dict) --

      The map of environment variables that are available to the Lambda function when it runs.

      • (string) --

        • (string) --

    • linuxProcessParams (dict) --

      The parameters for the Linux process that contains the Lambda function.

      • isolationMode (string) --

        The isolation mode for the process that contains the Lambda function. The process can run in an isolated runtime environment inside the IoT Greengrass container, or as a regular process outside any container.

        Default: GreengrassContainer

      • containerParams (dict) --

        The parameters for the container in which the Lambda function runs.

        • memorySizeInKB (integer) --

          The memory size of the container, expressed in kilobytes.

          Default: 16384 (16 MB)

        • mountROSysfs (boolean) --

          Whether or not the container can read information from the device's /sys folder.

          Default: false

        • volumes (list) --

          The list of volumes that the container can access.

          • (dict) --

            Contains information about a volume that Linux processes in a container can access. When you define a volume, the IoT Greengrass Core software mounts the source files to the destination inside the container.

            • sourcePath (string) -- [REQUIRED]

              The path to the physical volume in the file system.

            • destinationPath (string) -- [REQUIRED]

              The path to the logical volume in the file system.

            • permission (string) --

              The permission to access the volume: read/only ( ro) or read/write ( rw).

              Default: ro

            • addGroupOwner (boolean) --

              Whether or not to add the IoT Greengrass user group as an owner of the volume.

              Default: false

        • devices (list) --

          The list of system devices that the container can access.

          • (dict) --

            Contains information about a device that Linux processes in a container can access.

            • path (string) -- [REQUIRED]

              The mount path for the device in the file system.

            • permission (string) --

              The permission to access the device: read/only ( ro) or read/write ( rw).

              Default: ro

            • addGroupOwner (boolean) --

              Whether or not to add the component's system user as an owner of the device.

              Default: false

type tags:

dict

param tags:

A list of key-value pairs that contain metadata for the resource. For more information, see Tag your resources in the IoT Greengrass V2 Developer Guide.

  • (string) --

    • (string) --

type clientToken:

string

param clientToken:

A unique, case-sensitive identifier that you can provide to ensure that the request is idempotent. Idempotency means that the request is successfully processed only once, even if you send the request multiple times. When a request succeeds, and you specify the same client token for subsequent successful requests, the IoT Greengrass V2 service returns the successful response that it caches from the previous request. IoT Greengrass V2 caches successful responses for idempotent requests for up to 8 hours.

This field is autopopulated if not provided.

rtype:

dict

returns:

Response Syntax

{
    'arn': 'string',
    'componentName': 'string',
    'componentVersion': 'string',
    'creationTimestamp': datetime(2015, 1, 1),
    'status': {
        'componentState': 'REQUESTED'|'INITIATED'|'DEPLOYABLE'|'FAILED'|'DEPRECATED',
        'message': 'string',
        'errors': {
            'string': 'string'
        },
        'vendorGuidance': 'ACTIVE'|'DISCONTINUED'|'DELETED',
        'vendorGuidanceMessage': 'string'
    }
}

Response Structure

  • (dict) --

    • arn (string) --

      The ARN of the component version.

    • componentName (string) --

      The name of the component.

    • componentVersion (string) --

      The version of the component.

    • creationTimestamp (datetime) --

      The time at which the component was created, expressed in ISO 8601 format.

    • status (dict) --

      The status of the component version in IoT Greengrass V2. This status is different from the status of the component on a core device.

      • componentState (string) --

        The state of the component version.

      • message (string) --

        A message that communicates details, such as errors, about the status of the component version.

      • errors (dict) --

        A dictionary of errors that communicate why the component version is in an error state. For example, if IoT Greengrass can't access an artifact for the component version, then errors contains the artifact's URI as a key, and the error message as the value for that key.

        • (string) --

          • (string) --

      • vendorGuidance (string) --

        The vendor guidance state for the component version. This state indicates whether the component version has any issues that you should consider before you deploy it. The vendor guidance state can be:

        • ACTIVE – This component version is available and recommended for use.

        • DISCONTINUED – This component version has been discontinued by its publisher. You can deploy this component version, but we recommend that you use a different version of this component.

        • DELETED – This component version has been deleted by its publisher, so you can't deploy it. If you have any existing deployments that specify this component version, those deployments will fail.

      • vendorGuidanceMessage (string) --

        A message that communicates details about the vendor guidance state of the component version. This message communicates why a component version is discontinued or deleted.

DescribeComponent (updated) Link ¶
Changes (response)
{'status': {'vendorGuidance': 'ACTIVE | DISCONTINUED | DELETED',
            'vendorGuidanceMessage': 'string'}}

Retrieves metadata for a version of a component.

See also: AWS API Documentation

Request Syntax

client.describe_component(
    arn='string'
)
type arn:

string

param arn:

[REQUIRED]

The ARN of the component version.

rtype:

dict

returns:

Response Syntax

{
    'arn': 'string',
    'componentName': 'string',
    'componentVersion': 'string',
    'creationTimestamp': datetime(2015, 1, 1),
    'publisher': 'string',
    'description': 'string',
    'status': {
        'componentState': 'REQUESTED'|'INITIATED'|'DEPLOYABLE'|'FAILED'|'DEPRECATED',
        'message': 'string',
        'errors': {
            'string': 'string'
        },
        'vendorGuidance': 'ACTIVE'|'DISCONTINUED'|'DELETED',
        'vendorGuidanceMessage': 'string'
    },
    'platforms': [
        {
            'name': 'string',
            'attributes': {
                'string': 'string'
            }
        },
    ],
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • arn (string) --

      The ARN of the component version.

    • componentName (string) --

      The name of the component.

    • componentVersion (string) --

      The version of the component.

    • creationTimestamp (datetime) --

      The time at which the component was created, expressed in ISO 8601 format.

    • publisher (string) --

      The publisher of the component version.

    • description (string) --

      The description of the component version.

    • status (dict) --

      The status of the component version in IoT Greengrass V2. This status is different from the status of the component on a core device.

      • componentState (string) --

        The state of the component version.

      • message (string) --

        A message that communicates details, such as errors, about the status of the component version.

      • errors (dict) --

        A dictionary of errors that communicate why the component version is in an error state. For example, if IoT Greengrass can't access an artifact for the component version, then errors contains the artifact's URI as a key, and the error message as the value for that key.

        • (string) --

          • (string) --

      • vendorGuidance (string) --

        The vendor guidance state for the component version. This state indicates whether the component version has any issues that you should consider before you deploy it. The vendor guidance state can be:

        • ACTIVE – This component version is available and recommended for use.

        • DISCONTINUED – This component version has been discontinued by its publisher. You can deploy this component version, but we recommend that you use a different version of this component.

        • DELETED – This component version has been deleted by its publisher, so you can't deploy it. If you have any existing deployments that specify this component version, those deployments will fail.

      • vendorGuidanceMessage (string) --

        A message that communicates details about the vendor guidance state of the component version. This message communicates why a component version is discontinued or deleted.

    • platforms (list) --

      The platforms that the component version supports.

      • (dict) --

        Contains information about a platform that a component supports.

        • name (string) --

          The friendly name of the platform. This name helps you identify the platform.

          If you omit this parameter, IoT Greengrass creates a friendly name from the os and architecture of the platform.

        • attributes (dict) --

          A dictionary of attributes for the platform. The IoT Greengrass Core software defines the os and platform by default. You can specify additional platform attributes for a core device when you deploy the Greengrass nucleus component. For more information, see the Greengrass nucleus component in the IoT Greengrass V2 Developer Guide.

          • (string) --

            • (string) --

    • tags (dict) --

      A list of key-value pairs that contain metadata for the resource. For more information, see Tag your resources in the IoT Greengrass V2 Developer Guide.

      • (string) --

        • (string) --

ResolveComponentCandidates (updated) Link ¶
Changes (response)
{'resolvedComponentVersions': {'message': 'string',
                               'vendorGuidance': 'ACTIVE | DISCONTINUED | '
                                                 'DELETED'}}

Retrieves a list of components that meet the component, version, and platform requirements of a deployment. Greengrass core devices call this operation when they receive a deployment to identify the components to install.

This operation identifies components that meet all dependency requirements for a deployment. If the requirements conflict, then this operation returns an error and the deployment fails. For example, this occurs if component A requires version >2.0.0 and component B requires version <2.0.0 of a component dependency.

When you specify the component candidates to resolve, IoT Greengrass compares each component's digest from the core device with the component's digest in the Amazon Web Services Cloud. If the digests don't match, then IoT Greengrass specifies to use the version from the Amazon Web Services Cloud.

See also: AWS API Documentation

Request Syntax

client.resolve_component_candidates(
    platform={
        'name': 'string',
        'attributes': {
            'string': 'string'
        }
    },
    componentCandidates=[
        {
            'componentName': 'string',
            'componentVersion': 'string',
            'versionRequirements': {
                'string': 'string'
            }
        },
    ]
)
type platform:

dict

param platform:

The platform to use to resolve compatible components.

  • name (string) --

    The friendly name of the platform. This name helps you identify the platform.

    If you omit this parameter, IoT Greengrass creates a friendly name from the os and architecture of the platform.

  • attributes (dict) --

    A dictionary of attributes for the platform. The IoT Greengrass Core software defines the os and platform by default. You can specify additional platform attributes for a core device when you deploy the Greengrass nucleus component. For more information, see the Greengrass nucleus component in the IoT Greengrass V2 Developer Guide.

    • (string) --

      • (string) --

type componentCandidates:

list

param componentCandidates:

The list of components to resolve.

  • (dict) --

    Contains information about a component that is a candidate to deploy to a Greengrass core device.

    • componentName (string) --

      The name of the component.

    • componentVersion (string) --

      The version of the component.

    • versionRequirements (dict) --

      The version requirements for the component's dependencies. Greengrass core devices get the version requirements from component recipes.

      IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning.

      • (string) --

        • (string) --

rtype:

dict

returns:

Response Syntax

{
    'resolvedComponentVersions': [
        {
            'arn': 'string',
            'componentName': 'string',
            'componentVersion': 'string',
            'recipe': b'bytes',
            'vendorGuidance': 'ACTIVE'|'DISCONTINUED'|'DELETED',
            'message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • resolvedComponentVersions (list) --

      A list of components that meet the requirements that you specify in the request. This list includes each component's recipe that you can use to install the component.

      • (dict) --

        Contains information about a component version that is compatible to run on a Greengrass core device.

        • arn (string) --

          The ARN of the component version.

        • componentName (string) --

          The name of the component.

        • componentVersion (string) --

          The version of the component.

        • recipe (bytes) --

          The recipe of the component version.

        • vendorGuidance (string) --

          The vendor guidance state for the component version. This state indicates whether the component version has any issues that you should consider before you deploy it. The vendor guidance state can be:

          • ACTIVE – This component version is available and recommended for use.

          • DISCONTINUED – This component version has been discontinued by its publisher. You can deploy this component version, but we recommend that you use a different version of this component.

          • DELETED – This component version has been deleted by its publisher, so you can't deploy it. If you have any existing deployments that specify this component version, those deployments will fail.

        • message (string) --

          A message that communicates details about the vendor guidance state of the component version. This message communicates why a component version is discontinued or deleted.