images
Creates, updates, deletes, gets or lists an images resource.
Overview
| Name | images |
| Type | Resource |
| Id | aws.imagebuilder.images |
Fields
The following fields are returned by SELECT queries:
- get_image
- list_images
| Name | Datatype | Description |
|---|---|---|
image | object | The image object. |
latest_version_references | object | The resource ARNs with different wildcard variations of semantic versioning. |
request_id | string | The request ID that uniquely identifies this request. |
| Name | Datatype | Description |
|---|---|---|
name | string | The name of this specific version of an Image Builder image. (pattern: <code>^[-_A-Za-z-0-9][-_A-Za-z0-9 ]{1,126}[-_A-Za-z-0-9]$</code>) |
arn | string | The Amazon Resource Name (ARN) of a specific version of an Image Builder image. Semantic versioning is included in each object's Amazon Resource Name (ARN), at the level that applies to that object as follows: Versionless ARNs and Name ARNs do not include specific values in any of the nodes. The nodes are either left off entirely, or they are specified as wildcards, for example: x.x.x. Version ARNs have only the first three nodes: <major>.<minor>.<patch> Build version ARNs have all four nodes, and point to a specific build for a specific version of an object. (pattern: <code>^arn:aws[^:]*:imagebuilder:[^:]+:(?:[0-9]{12}|aws(?:-[a-z-]+)?):(?:image-recipe|container-recipe|infrastructure-configuration|distribution-configuration|component|image|image-pipeline|lifecycle-policy|workflow/(?:build|test|distribution))/[a-z0-9-_]+(?:/(?:(?:x|[0-9]+).(?:x|[0-9]+).(?:x|[0-9]+))(?:/[0-9]+)?)?$</code>) |
build_type | string | Indicates the type of build that created this image. The build can be initiated in the following ways: USER_INITIATED – A manual pipeline build request. SCHEDULED – A pipeline build initiated by a cron expression in the Image Builder pipeline, or from EventBridge. IMPORT – A VM import created the image to use as the base image for the recipe. IMPORT_ISO – An ISO disk import created the image. (USER_INITIATED, SCHEDULED, IMPORT, IMPORT_ISO) |
date_created | string | The date on which this specific version of the Image Builder image was created. |
image_source | string | The origin of the base image that Image Builder used to build this image. (AMAZON_MANAGED, AWS_MARKETPLACE, IMPORTED, CUSTOM) |
os_version | string | The operating system version of the Amazon EC2 build instance. For example, Amazon Linux 2, Ubuntu 18, or Microsoft Windows Server 2019. |
owner | string | The owner of the image version. |
platform | string | The operating system platform of the image version, for example "Windows" or "Linux". (Windows, Linux, macOS) |
type_ | string | Specifies whether this image produces an AMI or a container image. (AMI, DOCKER) |
version | string | Details for a specific version of an Image Builder image. This version follows the semantic version syntax. The semantic version has four nodes: <major>.<minor>.<patch>/<build>. You can assign values for the first three, and can filter on all of them. Assignment: For the first three nodes you can assign any positive integer value, including zero, with an upper limit of 2^30-1, or 1073741823 for each node. Image Builder automatically assigns the build number to the fourth node. Patterns: You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01. Filtering: With semantic versioning, you have the flexibility to use wildcards (x) to specify the most recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in any node, all nodes to the right of the first wildcard must also be wildcards. (pattern: <code>^[0-9]+.[0-9]+.[0-9]+$</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_image | select | imageBuildVersionArn, region | Gets an image. | |
list_images | select | region | Returns 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_image | insert | region, infrastructureConfigurationArn, clientToken | 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. | |
delete_image | delete | imageBuildVersionArn, region | 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. | |
cancel_image_creation | exec | region, imageBuildVersionArn, clientToken | CancelImageCreation 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.
| Name | Datatype | Description |
|---|---|---|
imageBuildVersionArn | string | The Amazon Resource Name (ARN) of the Image Builder image resource to delete. |
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_image
- list_images
Gets an image.
SELECT
image,
latest_version_references,
request_id
FROM aws.imagebuilder.images
WHERE imageBuildVersionArn = '{{ imageBuildVersionArn }}' -- required
AND region = '{{ region }}' -- required
;
Returns 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.
SELECT
name,
arn,
build_type,
date_created,
image_source,
os_version,
owner,
platform,
type_,
version
FROM aws.imagebuilder.images
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_image
- Manifest
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
;
# Description fields are for documentation purposes
- name: images
props:
- name: region
value: "{{ region }}"
description: Required parameter for the images resource.
- name: imageRecipeArn
value: "{{ imageRecipeArn }}"
- name: containerRecipeArn
value: "{{ containerRecipeArn }}"
- name: distributionConfigurationArn
value: "{{ distributionConfigurationArn }}"
- name: infrastructureConfigurationArn
value: "{{ infrastructureConfigurationArn }}"
- name: imageTestsConfiguration
description: |
Configure image tests for your pipeline build. Tests run after building the image, to verify that the AMI or container image is valid before distributing it.
value:
imageTestsEnabled: {{ imageTestsEnabled }}
timeoutMinutes: {{ timeoutMinutes }}
- name: enhancedImageMetadataEnabled
value: {{ enhancedImageMetadataEnabled }}
- name: tags
value: "{{ tags }}"
- name: clientToken
value: "{{ clientToken }}"
- name: imageScanningConfiguration
description: |
Contains settings for Image Builder image resource and container image scans.
value:
imageScanningEnabled: {{ imageScanningEnabled }}
ecrConfiguration:
repositoryName: "{{ repositoryName }}"
containerTags:
- "{{ containerTags }}"
- name: workflows
value:
- workflowArn: "{{ workflowArn }}"
parameters: "{{ parameters }}"
parallelGroup: "{{ parallelGroup }}"
onFailure: "{{ onFailure }}"
- name: executionRole
value: "{{ executionRole }}"
- name: loggingConfiguration
description: |
The logging configuration that's defined for the image. Image Builder uses the defined settings to direct execution log output during image creation.
value:
logGroupName: "{{ logGroupName }}"
DELETE examples
- delete_image
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
- cancel_image_creation
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 }}"
}'
;