Skip to main content

deployments

Creates, updates, deletes, gets or lists a deployments resource.

Overview

Namedeployments
TypeResource
Idaws.greengrassv2.deployments

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
componentsobjectThe components to deploy. This is a dictionary, where each key is the name of a component, and each key's value is the version and configuration to deploy for that component.
creation_timestampstring (date-time)The time at which the deployment was created, expressed in ISO 8601 format.
deployment_idstringThe ID of the deployment.
deployment_namestringThe name of the deployment.
deployment_policiesobjectContains information about policies that define how a deployment updates components and handles failure.
deployment_statusstringThe status of the deployment. (ACTIVE, COMPLETED, CANCELED, FAILED, INACTIVE)
iot_job_arnstringThe ARN of the IoT job that applies the deployment to target devices. (pattern: <code>arn:[^:]*:iot:[^:]+:[0-9]+:job/.+</code>)
iot_job_configurationobjectContains information about an IoT job configuration.
iot_job_idstringThe ID of the IoT job that applies the deployment to target devices.
is_latest_for_targetbooleanWhether or not the deployment is the latest revision for its target.
parent_target_arnstringThe parent deployment's target ARN within a subdeployment. (pattern: <code>arn:[^:]:iot:[^:]:[0-9]+:thinggroup/.+</code>)
revision_idstringThe revision number of the deployment.
tagsobjectA 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.
target_arnstringThe ARN of the target IoT thing or thing group. (pattern: <code>arn:[^:]:iot:[^:]:[0-9]+:(thing|thinggroup)/.+</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_deploymentselectdeployment_id, regionGets a deployment. Deployments define the components that run on Greengrass core devices.
list_deploymentsselectregiontargetArn, historyFilter, parentTargetArn, maxResults, nextTokenRetrieves a paginated list of deployments.
create_deploymentinsertregion, targetArnCreates a continuous deployment for a target, which is a Greengrass core device or group of core devices. When you add a new core device to a group of core devices that has a deployment, IoT Greengrass deploys that group's deployment to the new device. You can define one deployment for each target. When you create a new deployment for a target that has an existing deployment, you replace the previous deployment. IoT Greengrass applies the new deployment to the target devices. Every deployment has a revision number that indicates how many deployment revisions you define for a target. Use this operation to create a new revision of an existing deployment. For more information, see the Create deployments in the IoT Greengrass V2 Developer Guide.
delete_deploymentdeletedeployment_id, regionDeletes 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.
cancel_deploymentexecdeployment_id, regionCancels a deployment. This operation cancels the deployment for devices that haven't yet received it. If a device already received the deployment, this operation doesn't change anything for that device.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_idstringThe ID of the deployment.
regionstringAWS region (default: us-east-1)
historyFilterstringThe filter for the list of deployments. Choose one of the following options: ALL – The list includes all deployments. LATEST_ONLY – The list includes only the latest revision of each deployment. Default: LATEST_ONLY
maxResultsintegerThe maximum number of results to be returned per paginated request. Default: 50
nextTokenstringThe token to be used for the next set of paginated results.
parentTargetArnstringThe parent deployment's target ARN within a subdeployment.
targetArnstringThe ARN of the target IoT thing or thing group.

SELECT examples

Gets a deployment. Deployments define the components that run on Greengrass core devices.

SELECT
components,
creation_timestamp,
deployment_id,
deployment_name,
deployment_policies,
deployment_status,
iot_job_arn,
iot_job_configuration,
iot_job_id,
is_latest_for_target,
parent_target_arn,
revision_id,
tags,
target_arn
FROM aws.greengrassv2.deployments
WHERE deployment_id = '{{ deployment_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a continuous deployment for a target, which is a Greengrass core device or group of core devices. When you add a new core device to a group of core devices that has a deployment, IoT Greengrass deploys that group's deployment to the new device. You can define one deployment for each target. When you create a new deployment for a target that has an existing deployment, you replace the previous deployment. IoT Greengrass applies the new deployment to the target devices. Every deployment has a revision number that indicates how many deployment revisions you define for a target. Use this operation to create a new revision of an existing deployment. For more information, see the Create deployments in the IoT Greengrass V2 Developer Guide.

INSERT INTO aws.greengrassv2.deployments (
targetArn,
deploymentName,
components,
iotJobConfiguration,
deploymentPolicies,
parentTargetArn,
tags,
clientToken,
region
)
SELECT
'{{ targetArn }}' /* required */,
'{{ deploymentName }}',
'{{ components }}',
'{{ iotJobConfiguration }}',
'{{ deploymentPolicies }}',
'{{ parentTargetArn }}',
'{{ tags }}',
'{{ clientToken }}',
'{{ region }}'
RETURNING
deployment_id,
iot_job_arn,
iot_job_id
;

DELETE examples

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.

DELETE FROM aws.greengrassv2.deployments
WHERE deployment_id = '{{ deployment_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Cancels a deployment. This operation cancels the deployment for devices that haven't yet received it. If a device already received the deployment, this operation doesn't change anything for that device.

EXEC aws.greengrassv2.deployments.cancel_deployment
@deployment_id='{{ deployment_id }}' --required,
@region='{{ region }}' --required
;