Skip to main content

images

Creates, updates, deletes, gets or lists an images resource.

Overview

Nameimages
TypeResource
Idaws.imagebuilder.images

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
imageobjectThe image object.
latest_version_referencesobjectThe resource ARNs with different wildcard variations of semantic versioning.
request_idstringThe request ID that uniquely identifies this request.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_imageselectimageBuildVersionArn, regionGets an image.
list_imagesselectregionReturns the list of images that you have access to. Newly created images can take up to two minutes to appear in the ListImages API Results.
create_imageinsertregion, infrastructureConfigurationArn, clientTokenCreates a new image. This request will create a new image along with all of the configured output resources defined in the distribution configuration. You must specify exactly one recipe for your image, using either a ContainerRecipeArn or an ImageRecipeArn.
delete_imagedeleteimageBuildVersionArn, regionDeletes an Image Builder image resource. This does not delete any EC2 AMIs or ECR container images that are created during the image build process. You must clean those up separately, using the appropriate Amazon EC2 or Amazon ECR console actions, or API or CLI commands. To deregister an EC2 Linux AMI, see Deregister your Linux AMI in the Amazon EC2 User Guide . To deregister an EC2 Windows AMI, see Deregister your Windows AMI in the Amazon EC2 Windows Guide . To delete a container image from Amazon ECR, see Deleting an image in the Amazon ECR User Guide.
cancel_image_creationexecregion, imageBuildVersionArn, clientTokenCancelImageCreation cancels the creation of Image. This operation can only be used on images in a non-terminal state.

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
imageBuildVersionArnstringThe Amazon Resource Name (ARN) of the Image Builder image resource to delete.
regionstringAWS region (default: us-east-1)

SELECT examples

Gets an image.

SELECT
image,
latest_version_references,
request_id
FROM aws.imagebuilder.images
WHERE imageBuildVersionArn = '{{ imageBuildVersionArn }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a new image. This request will create a new image along with all of the configured output resources defined in the distribution configuration. You must specify exactly one recipe for your image, using either a ContainerRecipeArn or an ImageRecipeArn.

INSERT INTO aws.imagebuilder.images (
imageRecipeArn,
containerRecipeArn,
distributionConfigurationArn,
infrastructureConfigurationArn,
imageTestsConfiguration,
enhancedImageMetadataEnabled,
tags,
clientToken,
imageScanningConfiguration,
workflows,
executionRole,
loggingConfiguration,
region
)
SELECT
'{{ imageRecipeArn }}',
'{{ containerRecipeArn }}',
'{{ distributionConfigurationArn }}',
'{{ infrastructureConfigurationArn }}' /* required */,
'{{ imageTestsConfiguration }}',
{{ enhancedImageMetadataEnabled }},
'{{ tags }}',
'{{ clientToken }}' /* required */,
'{{ imageScanningConfiguration }}',
'{{ workflows }}',
'{{ executionRole }}',
'{{ loggingConfiguration }}',
'{{ region }}'
RETURNING
client_token,
image_build_version_arn,
latest_version_references,
request_id
;

DELETE examples

Deletes an Image Builder image resource. This does not delete any EC2 AMIs or ECR container images that are created during the image build process. You must clean those up separately, using the appropriate Amazon EC2 or Amazon ECR console actions, or API or CLI commands. To deregister an EC2 Linux AMI, see Deregister your Linux AMI in the Amazon EC2 User Guide . To deregister an EC2 Windows AMI, see Deregister your Windows AMI in the Amazon EC2 Windows Guide . To delete a container image from Amazon ECR, see Deleting an image in the Amazon ECR User Guide.

DELETE FROM aws.imagebuilder.images
WHERE imageBuildVersionArn = '{{ imageBuildVersionArn }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

CancelImageCreation cancels the creation of Image. This operation can only be used on images in a non-terminal state.

EXEC aws.imagebuilder.images.cancel_image_creation
@region='{{ region }}' --required
@@json=
'{
"imageBuildVersionArn": "{{ imageBuildVersionArn }}",
"clientToken": "{{ clientToken }}"
}'
;