This documentation is for Version 1 of the Amazon CLI only. For documentation related to Version 2 of the Amazon CLI, see the Version 2 User Guide.
Image Builder examples using Amazon CLI
The following code examples show you how to perform actions and implement common scenarios by using the Amazon Command Line Interface with Image Builder.
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.
Topics
Actions
The following code example shows how to use create-component.
- Amazon CLI
-
To create a component
The following
create-componentexample creates a component that uses a JSON document file and references a component document in YAML format that is uploaded to an Amazon S3 bucket.aws imagebuilder create-component \ --cli-input-jsonfile://create-component.jsonContents of
create-component.json:{ "name": "MyExampleComponent", "semanticVersion": "2019.12.02", "description": "An example component that builds, validates and tests an image", "changeDescription": "Initial version.", "platform": "Windows", "uri": "s3://s3-bucket-name/s3-bucket-path/component.yaml" }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "clientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "componentBuildVersionArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/examplecomponent/2019.12.02/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see CreateComponent
in Amazon CLI Command Reference.
-
The following code example shows how to use create-distribution-configuration.
- Amazon CLI
-
To create a distribution configuration
The following
create-distribution-configurationexample creates a distribution configuration using a JSON file.aws imagebuilder create-distribution-configuration \ --cli-input-jsonfile:/create-distribution-configuration.jsonContents of
create-distribution-configuration.json:{ "name": "MyExampleDistribution", "description": "Copies AMI to eu-west-1", "distributions": [ { "region": "us-west-2", "amiDistributionConfiguration": { "name": "Name {{imagebuilder:buildDate}}", "description": "An example image name with parameter references", "amiTags": { "KeyName": "{{ssm:parameter_name}}" }, "launchPermission": { "userIds": [ "123456789012" ] } } }, { "region": "eu-west-1", "amiDistributionConfiguration": { "name": "My {{imagebuilder:buildVersion}} image {{imagebuilder:buildDate}}", "amiTags": { "KeyName": "Value" }, "launchPermission": { "userIds": [ "123456789012" ] } } } ] }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "clientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "distributionConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistribution" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see CreateDistributionConfiguration
in Amazon CLI Command Reference.
-
The following code example shows how to use create-image-pipeline.
- Amazon CLI
-
To create an image pipeline
The following
create-image-pipelineexample creates an image pipeline using a JSON file.aws imagebuilder create-image-pipeline \ --cli-input-jsonfile://create-image-pipeline.jsonContents of
create-image-pipeline.json:{ "name": "MyWindows2016Pipeline", "description": "Builds Windows 2016 Images", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03", "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure", "distributionConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistribution", "imageTestsConfiguration": { "imageTestsEnabled": true, "timeoutMinutes": 60 }, "schedule": { "scheduleExpression": "cron(0 0 * * SUN)", "pipelineExecutionStartCondition": "EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE" }, "status": "ENABLED" }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "clientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "imagePipelineArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipeline" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see CreateImagePipeline
in Amazon CLI Command Reference.
-
The following code example shows how to use create-image-recipe.
- Amazon CLI
-
To create a recipe
The following
create-image-recipeexample creates an image recipe using a JSON file. Components are installed in the order in which they are specified.aws imagebuilder create-image-recipe \ --cli-input-jsonfile://create-image-recipe.jsonContents of
create-image-recipe.json:{ "name": "MyBasicRecipe", "description": "This example image recipe creates a Windows 2016 image.", "semanticVersion": "2019.12.03", "components": [ { "componentArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/myexamplecomponent/2019.12.02/1" }, { "componentArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/myimportedcomponent/1.0.0/1" } ], "parentImage": "arn:aws:imagebuilder:us-west-2:aws:image/windows-server-2016-english-full-base-x86/xxxx.x.x" }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "clientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see CreateImageRecipe
in Amazon CLI Command Reference.
-
The following code example shows how to use create-image.
- Amazon CLI
-
To create an image
The following
create-imageexample creates an image.aws imagebuilder create-image \ --image-recipe-arnarn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03\ --infrastructure-configuration-arnarn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructureOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "clientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "imageBuildVersionArn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see CreateImage
in Amazon CLI Command Reference.
-
The following code example shows how to use create-infrastructure-configuration.
- Amazon CLI
-
To create an infrastructure configuration
The following
create-infrastructure-configurationexample creates an infrastructure configuration using a JSON file.aws imagebuilder create-infrastructure-configuration \ --cli-input-jsonfile://create-infrastructure-configuration.jsonContents of
create-infrastructure-configuration.json:{ "name": "MyExampleInfrastructure", "description": "An example that will retain instances of failed builds", "instanceTypes": [ "m5.large", "m5.xlarge" ], "instanceProfileName": "EC2InstanceProfileForImageBuilder", "securityGroupIds": [ "sg-a1b2c3d4" ], "subnetId": "subnet-a1b2c3d4", "logging": { "s3Logs": { "s3BucketName": "bucket-name", "s3KeyPrefix": "bucket-path" } }, "keyPair": "key-pair-name", "terminateInstanceOnFailure": false, "snsTopicArn": "arn:aws:sns:us-west-2:123456789012:sns-topic-name" }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "clientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see CreateInfrastructureConfiguration
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-component.
- Amazon CLI
-
To delete a component
The following
delete-componentexample deletes a component build version by specifying its ARN.aws imagebuilder delete-component \ --component-build-version-arnarn:aws:imagebuilder:us-west-2:123456789012:component/myexamplecomponent/2019.12.02/1Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "componentBuildVersionArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/myexamplecomponent/2019.12.02/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see DeleteComponent
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-image-pipeline.
- Amazon CLI
-
To delete an image pipeline
The following
delete-image-pipelineexample deletes an image pipeline by specifying its ARN.aws imagebuilder delete-image-pipeline \ --image-pipeline-arnarn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/my-example-pipelineOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imagePipelineArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipeline" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see DeleteImagePipeline
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-image-recipe.
- Amazon CLI
-
To delete an image recipe
The following
delete-image-recipeexample deletes an image recipe by specifying its ARN.aws imagebuilder delete-image-recipe \ --image-recipe-arnarn:aws:imagebuilder:us-east-1:123456789012:image-recipe/mybasicrecipe/2019.12.03Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see DeleteImageRecipe
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-image.
- Amazon CLI
-
To delete an image
The following
delete-imageexample deletes an image build version by specifying its ARN.aws imagebuilder delete-image \ --image-build-version-arnarn:aws:imagebuilder:us-west-2:123456789012:image/my-example-image/2019.12.02/1Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageBuildVersionArn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see DeleteImage
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-infrastructure-configuration.
- Amazon CLI
-
To delete an infrastructure configuration
The following
delete-infrastructure-configurationexample deletes an image pipeline by specifying its ARN.aws imagebuilder delete-infrastructure-configuration \ --infrastructure-configuration-arnarn:aws:imagebuilder:us-east-1:123456789012:infrastructure-configuration/myexampleinfrastructureOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see DeleteInfrastructureConfiguration
in Amazon CLI Command Reference.
-
The following code example shows how to use get-component-policy.
- Amazon CLI
-
To get component policy details
The following
get-component-policyexample lists the details of a component policy by specifying its ARN.aws imagebuilder get-component-policy \ --component-arnarn:aws:imagebuilder:us-west-2:123456789012:component/my-example-component/2019.12.03/1Output:
{ "Policy": "{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ "123456789012" ] }, "Action": [ "imagebuilder:GetComponent", "imagebuilder:ListComponents" ], "Resource": [ "arn:aws:imagebuilder:us-west-2:123456789012:component/my-example-component/2019.12.03/1" ] } ] }" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI <https://docs.aws.amazon.com/imagebuilder/latest/userguide/managing-image-builder-cli.html>`__ in the EC2 Image Builder Users Guide.
-
For API details, see GetComponentPolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use get-component.
- Amazon CLI
-
To get component details
The following
get-componentexample lists the details of a component by specifying its ARN.aws imagebuilder get-component \ --component-build-version-arnarn:aws:imagebuilder:us-west-2:123456789012:component/component-name/1.0.0/1Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "component": { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:component/component-name/1.0.0/1", "name": "component-name", "version": "1.0.0", "type": "TEST", "platform": "Linux", "owner": "123456789012", "data": "name: HelloWorldTestingDocument\ndescription: This is hello world testing document.\nschemaVersion: 1.0\n\nphases:\n - name: test\n steps:\n - name: HelloWorldStep\n action: ExecuteBash\n inputs:\n commands:\n - echo \"Hello World! Test.\"\n", "encrypted": true, "dateCreated": "2020-01-27T20:43:30.306Z", "tags": {} } }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see GetComponent
in Amazon CLI Command Reference.
-
The following code example shows how to use get-distribution-configuration.
- Amazon CLI
-
To get the details of a distribution configuration
The following
get-distribution-configurationexample displays the details of a distribution configuration by specifying its ARN.aws imagebuilder get-distribution-configuration \ --distribution-configuration-arnarn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistributionOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "distributionConfiguration": { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistribution", "name": "MyExampleDistribution", "description": "Copies AMI to eu-west-1 and exports to S3", "distributions": [ { "region": "us-west-2", "amiDistributionConfiguration": { "name": "Name {{imagebuilder:buildDate}}", "description": "An example image name with parameter references", "amiTags": { "KeyName": "{{ssm:parameter_name}}" }, "launchPermission": { "userIds": [ "123456789012" ] } } }, { "region": "eu-west-1", "amiDistributionConfiguration": { "name": "My {{imagebuilder:buildVersion}} image {{imagebuilder:buildDate}}", "amiTags": { "KeyName": "Value" }, "launchPermission": { "userIds": [ "123456789012" ] } } } ], "dateCreated": "2020-02-19T18:40:10.529Z", "tags": {} } }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see GetDistributionConfiguration
in Amazon CLI Command Reference.
-
The following code example shows how to use get-image-pipeline.
- Amazon CLI
-
To get image pipeline details
The following
get-image-pipelineexample lists the details of an image pipeline by specifying its ARN.aws imagebuilder get-image-pipeline \ --image-pipeline-arnarn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipelineOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imagePipeline": { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipeline", "name": "MyWindows2016Pipeline", "description": "Builds Windows 2016 Images", "platform": "Windows", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03", "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure", "distributionConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistribution", "imageTestsConfiguration": { "imageTestsEnabled": true, "timeoutMinutes": 60 }, "schedule": { "scheduleExpression": "cron(0 0 * * SUN)", "pipelineExecutionStartCondition": "EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE" }, "status": "ENABLED", "dateCreated": "2020-02-19T19:04:01.253Z", "dateUpdated": "2020-02-19T19:04:01.253Z", "tags": {} } }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see GetImagePipeline
in Amazon CLI Command Reference.
-
The following code example shows how to use get-image-policy.
- Amazon CLI
-
To get image policy details
The following
get-image-policyexample lists the details of an image policy by specifying its ARN.aws imagebuilder get-image-policy \ --image-arnarn:aws:imagebuilder:us-west-2:123456789012:image/my-example-image/2019.12.03/1Output:
{ "Policy": "{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ "123456789012" ] }, "Action": [ "imagebuilder:GetImage", "imagebuilder:ListImages" ], "Resource": [ "arn:aws:imagebuilder:us-west-2:123456789012:image/my-example-image/2019.12.03/1" ] } ] }" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see GetImagePolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use get-image-recipe-policy.
- Amazon CLI
-
To get image recipe policy details
The following
get-image-recipe-policyexample lists the details of an image recipe policy by specifying its ARN.aws imagebuilder get-image-recipe-policy \ --image-recipe-arnarn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-example-image-recipe/2019.12.03/1Output:
{ "Policy": "{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ "123456789012" ] }, "Action": [ "imagebuilder:GetImageRecipe", "imagebuilder:ListImageRecipes" ], "Resource": [ "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-example-image-recipe/2019.12.03/1" ] } ] }" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see GetImageRecipePolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use get-image.
- Amazon CLI
-
To get image details
The following
get-imageexample lists the details of an image by specifying its ARN.aws imagebuilder get-image \ --image-build-version-arnarn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/1Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "image": { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/1", "name": "MyBasicRecipe", "version": "2019.12.03/1", "platform": "Windows", "state": { "status": "BUILDING" }, "imageRecipe": { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03", "name": "MyBasicRecipe", "description": "This example image recipe creates a Windows 2016 image.", "platform": "Windows", "version": "2019.12.03", "components": [ { "componentArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/myexamplecomponent/2019.12.02/1" }, { "componentArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/myimportedcomponent/1.0.0/1" } ], "parentImage": "arn:aws:imagebuilder:us-west-2:aws:image/windows-server-2016-english-full-base-x86/2019.12.17/1", "dateCreated": "2020-02-14T19:46:16.904Z", "tags": {} }, "infrastructureConfiguration": { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure", "name": "MyExampleInfrastructure", "description": "An example that will retain instances of failed builds", "instanceTypes": [ "m5.large", "m5.xlarge" ], "instanceProfileName": "EC2InstanceProfileForImageFactory", "securityGroupIds": [ "sg-a1b2c3d4" ], "subnetId": "subnet-a1b2c3d4", "logging": { "s3Logs": { "s3BucketName": "bucket-name", "s3KeyPrefix": "bucket-path" } }, "keyPair": "Sam", "terminateInstanceOnFailure": false, "snsTopicArn": "arn:aws:sns:us-west-2:123456789012:sns-name", "dateCreated": "2020-02-14T21:21:05.098Z", "tags": {} }, "imageTestsConfiguration": { "imageTestsEnabled": true, "timeoutMinutes": 720 }, "dateCreated": "2020-02-14T23:14:13.597Z", "outputResources": { "amis": [] }, "tags": {} } }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see GetImage
in Amazon CLI Command Reference.
-
The following code example shows how to use get-infrastructure-configuration.
- Amazon CLI
-
To get infrastructure configuration details
The following
get-infrastructure-configurationexample lists the details of an infrastructure configuration by specifying its ARN.aws imagebuilder get-infrastructure-configuration \ --infrastructure-configuration-arnarn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructureOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "infrastructureConfiguration": { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure", "name": "MyExampleInfrastructure", "description": "An example that will retain instances of failed builds", "instanceTypes": [ "m5.large", "m5.xlarge" ], "instanceProfileName": "EC2InstanceProfileForImageBuilder", "securityGroupIds": [ "sg-a48c95ef" ], "subnetId": "subnet-a48c95ef", "logging": { "s3Logs": { "s3BucketName": "bucket-name", "s3KeyPrefix": "bucket-path" } }, "keyPair": "Name", "terminateInstanceOnFailure": false, "snsTopicArn": "arn:aws:sns:us-west-2:123456789012:sns-name", "dateCreated": "2020-02-19T19:11:51.858Z", "tags": {} } }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see GetInfrastructureConfiguration
in Amazon CLI Command Reference.
-
The following code example shows how to use import-component.
- Amazon CLI
-
To import a component
The following
import-componentexample imports a preexisting script using a JSON file.aws imagebuilder import-component \ --cli-input-jsonfile://import-component.jsonContents of
import-component.json:{ "name": "MyImportedComponent", "semanticVersion": "1.0.0", "description": "An example of how to import a component", "changeDescription": "First commit message.", "format": "SHELL", "platform": "Windows", "type": "BUILD", "uri": "s3://s3-bucket-name/s3-bucket-path/component.yaml" }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "clientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "componentBuildVersionArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/myimportedcomponent/1.0.0/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ImportComponent
in Amazon CLI Command Reference.
-
The following code example shows how to use list-component-build-versions.
- Amazon CLI
-
To list component build versions
The following
list-component-build-versionsexample lists the component build versions with a specific semantic version.aws imagebuilder list-component-build-versions --component-version-arnarn:aws:imagebuilder:us-west-2:123456789012:component/myexamplecomponent/2019.12.02Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "componentSummaryList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:component/myexamplecomponent/2019.12.02/1", "name": "MyExampleComponent", "version": "2019.12.02", "platform": "Windows", "type": "BUILD", "owner": "123456789012", "description": "An example component that builds, validates and tests an image", "changeDescription": "Initial version.", "dateCreated": "2020-02-19T18:53:45.940Z", "tags": { "KeyName": "KeyValue" } } ] }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListComponentBuildVersions
in Amazon CLI Command Reference.
-
The following code example shows how to use list-components.
- Amazon CLI
-
To list all of the component semantic versions
The following
list-componentsexample lists all of the component semantic versions to which you have access. You can optionally filter on whether to list components owned by you, by Amazon, or that have been shared with you by other accounts.aws imagebuilder list-componentsOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "componentVersionList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:component/component-name/1.0.0", "name": "component-name", "version": "1.0.0", "platform": "Linux", "type": "TEST", "owner": "123456789012", "dateCreated": "2020-01-27T20:43:30.306Z" } ] }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListComponents
in Amazon CLI Command Reference.
-
The following code example shows how to use list-distribution-configurations.
- Amazon CLI
-
To list distributions
The following
list-distribution-configurationsexample lists all of your distributions.aws imagebuilder list-distribution-configurationsOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "distributionConfigurationSummaryList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistribution", "name": "MyExampleDistribution", "description": "Copies AMI to eu-west-1 and exports to S3", "dateCreated": "2020-02-19T18:40:10.529Z", "tags": { "KeyName": "KeyValue" } } ] }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListDistributionConfigurations
in Amazon CLI Command Reference.
-
The following code example shows how to use list-image-build-versions.
- Amazon CLI
-
To list image build versions
The following
list-image-build-versionsexample lists all of the image build versions with a semantic version.aws imagebuilder list-image-build-versions \ --image-version-arnarn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageSummaryList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/7", "name": "MyBasicRecipe", "version": "2019.12.03/7", "platform": "Windows", "state": { "status": "FAILED", "reason": "Can't start SSM Automation for arn arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/7 during building. Parameter \"iamInstanceProfileName\" has a null value." }, "owner": "123456789012", "dateCreated": "2020-02-19T18:56:11.511Z", "outputResources": { "amis": [] }, "tags": {} }, { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/6", "name": "MyBasicRecipe", "version": "2019.12.03/6", "platform": "Windows", "state": { "status": "FAILED", "reason": "An internal error has occurred." }, "owner": "123456789012", "dateCreated": "2020-02-18T22:49:08.142Z", "outputResources": { "amis": [ { "region": "us-west-2", "image": "ami-a1b2c3d4567890ab", "name": "MyBasicRecipe 2020-02-18T22-49-38.704Z", "description": "This example image recipe creates a Windows 2016 image." }, { "region": "us-west-2", "image": "ami-a1b2c3d4567890ab", "name": "Name 2020-02-18T22-49-08.131Z", "description": "Copies AMI to eu-west-2 and exports to S3" }, { "region": "eu-west-2", "image": "ami-a1b2c3d4567890ab", "name": "My 6 image 2020-02-18T22-49-08.131Z", "description": "Copies AMI to eu-west-2 and exports to S3" } ] }, "tags": {} }, { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/5", "name": "MyBasicRecipe", "version": "2019.12.03/5", "platform": "Windows", "state": { "status": "AVAILABLE" }, "owner": "123456789012", "dateCreated": "2020-02-18T16:51:48.403Z", "outputResources": { "amis": [ { "region": "us-west-2", "image": "ami-a1b2c3d4567890ab", "name": "MyBasicRecipe 2020-02-18T16-52-18.965Z", "description": "This example image recipe creates a Windows 2016 image." } ] }, "tags": {} }, { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/4", "name": "MyBasicRecipe", "version": "2019.12.03/4", "platform": "Windows", "state": { "status": "AVAILABLE" }, "owner": "123456789012", "dateCreated": "2020-02-18T16:50:01.827Z", "outputResources": { "amis": [ { "region": "us-west-2", "image": "ami-a1b2c3d4567890ab", "name": "MyBasicRecipe 2020-02-18T16-50-32.280Z", "description": "This example image recipe creates a Windows 2016 image." } ] }, "tags": {} }, { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/3", "name": "MyBasicRecipe", "version": "2019.12.03/3", "platform": "Windows", "state": { "status": "AVAILABLE" }, "owner": "123456789012", "dateCreated": "2020-02-14T23:14:13.597Z", "outputResources": { "amis": [ { "region": "us-west-2", "image": "ami-a1b2c3d4567890ab", "name": "MyBasicRecipe 2020-02-14T23-14-44.243Z", "description": "This example image recipe creates a Windows 2016 image." } ] }, "tags": {} }, { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/2", "name": "MyBasicRecipe", "version": "2019.12.03/2", "platform": "Windows", "state": { "status": "FAILED", "reason": "SSM execution 'a1b2c3d4-5678-90ab-cdef-EXAMPLE11111' failed with status = 'Failed' and failure message = 'Step fails when it is verifying the command has completed. Command a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 returns unexpected invocation result: \n{Status=[Failed], ResponseCode=[1], Output=[\n----------ERROR-------\nfailed to run commands: exit status 1], OutputPayload=[{\"Status\":\"Failed\",\"ResponseCode\":1,\"Output\":\"\\n----------ERROR-------\\nfailed to run commands: exit status 1\",\"CommandId\":\"a1b2c3d4-5678-90ab-cdef-EXAMPLE11111\"}], CommandId=[a1b2c3d4-5678-90ab-cdef-EXAMPLE11111]}. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.'" }, "owner": "123456789012", "dateCreated": "2020-02-14T22:57:42.593Z", "outputResources": { "amis": [] }, "tags": {} } ] }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListImageBuildVersions
in Amazon CLI Command Reference.
-
The following code example shows how to use list-image-pipeline-images.
- Amazon CLI
-
To list image pipeline pipeline images
The following
list-image-pipeline-imagesexample lists all images that were created by a specific image pipeline.aws imagebuilder list-image-pipeline-images \ --image-pipeline-arnarn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipelineOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imagePipelineList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipeline", "name": "MyWindows2016Pipeline", "description": "Builds Windows 2016 Images", "platform": "Windows", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03", "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure", "distributionConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistribution", "imageTestsConfiguration": { "imageTestsEnabled": true, "timeoutMinutes": 60 }, "schedule": { "scheduleExpression": "cron(0 0 * * SUN)", "pipelineExecutionStartCondition": "EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE" }, "status": "ENABLED", "dateCreated": "2020-02-19T19:04:01.253Z", "dateUpdated": "2020-02-19T19:04:01.253Z", "tags": { "KeyName": "KeyValue" } }, { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/sam", "name": "PipelineName", "platform": "Linux", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/recipe-name-a1b2c3d45678/1.0.0", "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/infrastructureconfiguration-name-a1b2c3d45678", "imageTestsConfiguration": { "imageTestsEnabled": true, "timeoutMinutes": 720 }, "status": "ENABLED", "dateCreated": "2019-12-16T18:19:02.068Z", "dateUpdated": "2019-12-16T18:19:02.068Z", "tags": { "KeyName": "KeyValue" } } ] }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListImagePipelineImages
in Amazon CLI Command Reference.
-
The following code example shows how to use list-image-recipes.
- Amazon CLI
-
To list image recipes
The following
list-image-recipesexample lists all of your image recipes.aws imagebuilder list-image-recipesOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageRecipeSummaryList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03", "name": "MyBasicRecipe", "platform": "Windows", "owner": "123456789012", "parentImage": "arn:aws:imagebuilder:us-west-2:aws:image/windows-server-2016-english-full-base-x86/2019.x.x", "dateCreated": "2020-02-19T18:54:25.975Z", "tags": { "KeyName": "KeyValue" } }, { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/recipe-name-a1b2c3d45678/1.0.0", "name": "recipe-name-a1b2c3d45678", "platform": "Linux", "owner": "123456789012", "parentImage": "arn:aws:imagebuilder:us-west-2:aws:image/amazon-linux-2-x86/2019.11.21", "dateCreated": "2019-12-16T18:19:00.120Z", "tags": { "KeyName": "KeyValue" } } ] }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListImageRecipes
in Amazon CLI Command Reference.
-
The following code example shows how to use list-images.
- Amazon CLI
-
To list images
The following
list-imagesexample lists all of the semantic versions you have access to.aws imagebuilder list-imagesOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageVersionList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03", "name": "MyBasicRecipe", "version": "2019.12.03", "platform": "Windows", "owner": "123456789012", "dateCreated": "2020-02-14T21:29:18.810Z" } ] }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListImages
in Amazon CLI Command Reference.
-
The following code example shows how to use list-infrastructure-configurations.
- Amazon CLI
-
To list infrastructure configurations
The following
list-infrastructure-configurationsexample lists all of your infrastructure configurations.aws imagebuilder list-infrastructure-configurationsOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "infrastructureConfigurationSummaryList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure", "name": "MyExampleInfrastructure", "description": "An example that will retain instances of failed builds", "dateCreated": "2020-02-19T19:11:51.858Z", "tags": {} }, { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/infrastructureconfiguration-name-a1b2c3d45678", "name": "infrastructureConfiguration-name-a1b2c3d45678", "dateCreated": "2019-12-16T18:19:01.038Z", "tags": { "KeyName": "KeyValue" } } ] }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListInfrastructureConfigurations
in Amazon CLI Command Reference.
-
The following code example shows how to use list-tags-for-resource.
- Amazon CLI
-
To list tags for a specific resource
The following
list-tags-for-resourceexample lists all of the tags for a specific resource.aws imagebuilder list-tags-for-resource \ --resource-arnarn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipelineOutput:
{ "tags": { "KeyName": "KeyValue" } }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see ListTagsForResource
in Amazon CLI Command Reference.
-
The following code example shows how to use put-component-policy.
- Amazon CLI
-
To apply a resource policy to a component
The following
put-component-policycommand applies a resource policy to a build component to enable cross-account sharing of build components. We recommend you use the RAM CLI commandcreate-resource-share. If you use the EC2 Image Builder CLI commandput-component-policy, you must also use the RAM CLI commandpromote-resource-share-create-from-policyin order for the resource to be visible to all principals with whom the resource is shared.aws imagebuilder put-component-policy \ --component-arnarn:aws:imagebuilder:us-west-2:123456789012:component/examplecomponent/2019.12.02/1\ --policy '{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ "123456789012" ] }, "Action": [ "imagebuilder:GetComponent", "imagebuilder:ListComponents" ], "Resource": [ "arn:aws:imagebuilder:us-west-2:123456789012:component/examplecomponent/2019.12.02/1" ] } ] }'Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "componentArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/examplecomponent/2019.12.02/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see PutComponentPolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use put-image-policy.
- Amazon CLI
-
To apply a resource policy to an image
The following
put-image-policycommand applies a resource policy to an image to enable cross-account sharing of images. We recommend you use the RAM CLI command create-resource-share. If you use the EC2 Image Builder CLI command put-image-policy, you must also use the RAM CLI command promote-resource-share-create-from-policy in order for the resource to be visible to all principals with whom the resource is shared.aws imagebuilder put-image-policy \ --image-arnarn:aws:imagebuilder:us-west-2:123456789012:image/example-image/2019.12.02/1\ --policy '{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ "123456789012" ] }, "Action": [ "imagebuilder:GetImage", "imagebuilder:ListImages" ], "Resource": [ "arn:aws:imagebuilder:us-west-2:123456789012:image/example-image/2019.12.02/1" ] } ] }'Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageArn": "arn:aws:imagebuilder:us-west-2:123456789012:image/example-image/2019.12.02/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see PutImagePolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use put-image-recipe-policy.
- Amazon CLI
-
To apply a resource policy to an image recipe
The following
put-image-recipe-policycommand applies a resource policy to an image recipe to enable cross-account sharing of image recipes. We recommend that you use the RAM CLI commandcreate-resource-share. If you use the EC2 Image Builder CLI commandput-image-recipe-policy, you must also use the RAM CLI commandpromote-resource-share-create-from-policyin order for the resource to be visible to all principals with whom the resource is shared.aws imagebuilder put-image-recipe-policy \ --image-recipe-arnarn:aws:imagebuilder:us-west-2:123456789012:image-recipe/example-image-recipe/2019.12.02\ --policy '{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ "123456789012" ] }, "Action": [ "imagebuilder:GetImageRecipe", "imagebuilder:ListImageRecipes" ], "Resource": [ "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/example-image-recipe/2019.12.02" ] } ] }'Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/example-image-recipe/2019.12.02/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see PutImageRecipePolicy
in Amazon CLI Command Reference.
-
The following code example shows how to use start-image-pipeline-execution.
- Amazon CLI
-
To start an image pipeline manually
The following
start-image-pipeline-executionexample manually starts an image pipeline.aws imagebuilder start-image-pipeline-execution \ --image-pipeline-arnarn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipelineOutput:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "clientToken": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "imageBuildVersionArn": "arn:aws:imagebuilder:us-west-2:123456789012:image/mybasicrecipe/2019.12.03/1" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see StartImagePipelineExecution
in Amazon CLI Command Reference.
-
The following code example shows how to use tag-resource.
- Amazon CLI
-
To tag a resource
The following
tag-resourceexample adds and tags a resource to EC2 Image Builder using a JSON file.aws imagebuilder tag-resource \ --cli-input-jsonfile://tag-resource.jsonContents of
tag-resource.json:{ "resourceArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipeline", "tags": { "KeyName: "KeyValue" } }This command produces no output.
For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see TagResource
in Amazon CLI Command Reference.
-
The following code example shows how to use untag-resource.
- Amazon CLI
-
To remove a tag from a resource
The following
untag-resourceexample removes a tag from a resource using a JSON file.aws imagebuilder untag-resource \ --cli-input-jsonfile://tag-resource.jsonContents of
untag-resource.json:{ "resourceArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipeline", "tagKeys": [ "KeyName" ] }This command produces no output.
For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see UntagResource
in Amazon CLI Command Reference.
-
The following code example shows how to use update-distribution-configuration.
- Amazon CLI
-
To update a distribution configuration
The following
update-distribution-configurationexample updates a distribution configuration using a JSON file.aws imagebuilder update-distribution-configuration \ --cli-input-jsonfile://update-distribution-configuration.jsonContents of
update-distribution-configuration.json:{ "distributionConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistribution", "description": "Copies AMI to eu-west-2 and exports to S3", "distributions": [ { "region": "us-west-2", "amiDistributionConfiguration": { "name": "Name {{imagebuilder:buildDate}}", "description": "An example image name with parameter references" } }, { "region": "eu-west-2", "amiDistributionConfiguration": { "name": "My {{imagebuilder:buildVersion}} image {{imagebuilder:buildDate}}" } } ] }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see UpdateDistributionConfiguration
in Amazon CLI Command Reference.
-
The following code example shows how to use update-image-pipeline.
- Amazon CLI
-
To update an image pipeline
The following
update-image-pipelineexample updates an image pipeline using a JSON file.aws imagebuilder update-image-pipeline \ --cli-input-jsonfile://update-image-pipeline.jsonContents of
update-image-pipeline.json:{ "imagePipelineArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/mywindows2016pipeline", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/mybasicrecipe/2019.12.03", "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure", "distributionConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/myexampledistribution", "imageTestsConfiguration": { "imageTestsEnabled": true, "timeoutMinutes": 120 }, "schedule": { "scheduleExpression": "cron(0 0 * * MON)", "pipelineExecutionStartCondition": "EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE" }, "status": "DISABLED" }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see UpdateImagePipeline
in Amazon CLI Command Reference.
-
The following code example shows how to use update-infrastructure-configuration.
- Amazon CLI
-
To update an infrastructure configuration
The following
update-infrastructure-configurationexample updates an infrastructure configuration using a JSON file.aws imagebuilder update-infrastructure-configuration \ --cli-input-jsonfile:/update-infrastructure-configuration.jsonContents of
update-infrastructure-configuration.json:{ "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/myexampleinfrastructure", "description": "An example that will terminate instances of failed builds", "instanceTypes": [ "m5.large", "m5.2xlarge" ], "instanceProfileName": "EC2InstanceProfileForImageFactory", "securityGroupIds": [ "sg-a48c95ef" ], "subnetId": "subnet-a48c95ef", "logging": { "s3Logs": { "s3BucketName": "bucket-name", "s3KeyPrefix": "bucket-path" } }, "terminateInstanceOnFailure": true, "snsTopicArn": "arn:aws:sns:us-west-2:123456789012:sns-name" }Output:
{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }For more information, see Setting Up and Managing an EC2 Image Builder Image Pipeline Using the Amazon CLI
in the EC2 Image Builder Users Guide. -
For API details, see UpdateInfrastructureConfiguration
in Amazon CLI Command Reference.
-