imagebuilder / Client / create_image
create_image¶
- imagebuilder.Client.create_image(**kwargs)¶
Creates a new image along with all configured output resources defined in the distribution configuration. You must specify exactly one recipe for your image, using either a
containerRecipeArnor animageRecipeArn.The response returns as soon as Image Builder creates the new image resource. The image build process runs asynchronously. To check its progress, call GetImage and check the image status.
See also: AWS API Documentation
Request Syntax
response = client.create_image( imageRecipeArn='string', containerRecipeArn='string', distributionConfigurationArn='string', infrastructureConfigurationArn='string', imageTestsConfiguration={ 'imageTestsEnabled': True|False, 'timeoutMinutes': 123 }, enhancedImageMetadataEnabled=True|False, tags={ 'string': 'string' }, clientToken='string', imageScanningConfiguration={ 'imageScanningEnabled': True|False, 'ecrConfiguration': { 'repositoryName': 'string', 'containerTags': [ 'string', ] } }, workflows=[ { 'workflowArn': 'string', 'parameters': [ { 'name': 'string', 'value': [ 'string', ] }, ], 'parallelGroup': 'string', 'onFailure': 'CONTINUE'|'ABORT' }, ], executionRole='string', loggingConfiguration={ 'logGroupName': 'string' } )
- Parameters:
imageRecipeArn (string) – The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed. You must specify either this property or
containerRecipeArn, but not both.containerRecipeArn (string) – The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested. You must specify either this property or
imageRecipeArn, but not both.distributionConfigurationArn (string) – The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of the image build. If you don’t specify a distribution configuration, Image Builder creates the output image only in the account and Amazon Web Services Region where the build runs.
infrastructureConfigurationArn (string) –
[REQUIRED]
The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your image will be built and tested.
imageTestsConfiguration (dict) –
Settings that determine whether Image Builder runs tests on the image after building it. Image tests are enabled by default.
imageTestsEnabled (boolean) –
Specifies whether tests run after building the image. When enabled, tests run after the image build and before image distribution. Defaults to
true.timeoutMinutes (integer) –
The maximum time in minutes that tests are permitted to run. If you don’t specify a value, Image Builder stores and returns 720.
Note
The timeout property is not currently active. This value is ignored.
enhancedImageMetadataEnabled (boolean) – Specifies whether to collect additional information about the image being created, including the operating system (OS) version and package list. Defaults to
true.tags (dict) –
The tags of the image.
(string) –
(string) –
clientToken (string) –
[REQUIRED]
A unique, case-sensitive identifier you provide to ensure that the operation runs no more than one time. If you retry a request with the same client token, Image Builder returns the original response without running the operation again. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.
This field is autopopulated if not provided.
imageScanningConfiguration (dict) –
Settings for vulnerability scans that Amazon Inspector runs during image creation. For AMI output, Amazon Inspector scans the test instance. For container output, Amazon Inspector scans the container image that Image Builder pushes to the Amazon ECR repository specified in
ecrConfiguration.imageScanningEnabled (boolean) –
Specifies whether Amazon Inspector scans for vulnerabilities when you create a new image, and whether Image Builder saves the findings. Amazon Inspector must be enabled in the account. Image tests must also be enabled. For AMI output, Amazon Inspector scans the test instance. For container output, Amazon Inspector scans the container image that Image Builder pushes to the Amazon ECR repository from your
ecrConfigurationsettings.ecrConfiguration (dict) –
Contains Amazon ECR settings for vulnerability scans.
repositoryName (string) –
The name of the container repository where Image Builder pushes the container image for the vulnerability scan. Provide the repository name only (a namespace path is allowed, but not the registry hostname); the repository must already exist in your account. If you don’t specify a repository name, Image Builder creates the default repository
image-builder-image-scanning-repositoryin your account.containerTags (list) –
Tags for Image Builder to apply to the output container image that Amazon Inspector scans. Tags can help you identify and manage your scanned images.
(string) –
workflows (list) –
The array of workflow configuration objects for the build. If you specify workflows, they replace the default workflows that Image Builder otherwise runs for the build, and you must also provide an
executionRole.(dict) –
Contains control settings and configurable inputs for a workflow resource.
workflowArn (string) – [REQUIRED]
The Amazon Resource Name (ARN) of the workflow resource.
parameters (list) –
Contains parameter values for each of the parameters that the workflow document defined for the workflow resource.
(dict) –
Contains a key/value pair that sets the named workflow parameter.
name (string) – [REQUIRED]
The name of the workflow parameter to set.
value (list) – [REQUIRED]
Sets the value for the named workflow parameter.
(string) –
parallelGroup (string) –
Test workflows are defined within named runtime groups called parallel groups. The parallel group is the named group that contains this test workflow. Test workflows within a parallel group can run at the same time. Image Builder starts up to five test workflows in the group at the same time, and starts additional workflows as others complete, until all workflows in the group have completed. This field only applies for test workflows.
onFailure (string) –
The action to take if the workflow fails. With
CONTINUE, a failed workflow is logged and image creation proceeds to the next workflow. If you don’t set a value, the image build fails when the workflow fails. You can only set this property for test workflows.
executionRole (string) – The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions. This property is required if you specify
workflows. If you don’t provide a role, Image Builder uses the Image Builder service-linked role in your account, and creates it if it doesn’t exist.loggingConfiguration (dict) –
The CloudWatch Logs log group where Image Builder sends the image build logs. If you specify a log group name outside of the
/aws/imagebuilder/namespace, you must also provide anexecutionRolethat has permission to write to that log group.logGroupName (string) –
The log group name that Image Builder uses for image creation. If not specified, the log group name defaults to
/aws/imagebuilder/image-name.
- Return type:
dict
- Returns:
Response Syntax
{ 'requestId': 'string', 'clientToken': 'string', 'imageBuildVersionArn': 'string', 'latestVersionReferences': { 'latestVersionArn': 'string', 'latestMajorVersionArn': 'string', 'latestMinorVersionArn': 'string', 'latestPatchVersionArn': 'string' } }
Response Structure
(dict) –
requestId (string) –
The request ID that uniquely identifies this request.
clientToken (string) –
The client token that uniquely identifies the request.
imageBuildVersionArn (string) –
The Amazon Resource Name (ARN) of the image that the request created.
latestVersionReferences (dict) –
A set of wildcard version ARNs that always reference the latest version of the resource. ARNs are included for the latest version overall, and for the latest versions within the same major, minor, and patch levels.
latestVersionArn (string) –
The latest version Amazon Resource Name (ARN) of the Image Builder resource.
latestMajorVersionArn (string) –
The latest version Amazon Resource Name (ARN) with the same
majorversion of the Image Builder resource.latestMinorVersionArn (string) –
The latest version Amazon Resource Name (ARN) with the same
minorversion of the Image Builder resource.latestPatchVersionArn (string) –
The latest version Amazon Resource Name (ARN) with the same
patchversion of the Image Builder resource.
Exceptions
imagebuilder.Client.exceptions.ServiceExceptionimagebuilder.Client.exceptions.ClientExceptionimagebuilder.Client.exceptions.ServiceUnavailableExceptionimagebuilder.Client.exceptions.InvalidRequestExceptionimagebuilder.Client.exceptions.IdempotentParameterMismatchExceptionimagebuilder.Client.exceptions.ForbiddenExceptionimagebuilder.Client.exceptions.CallRateLimitExceededExceptionimagebuilder.Client.exceptions.ResourceInUseExceptionimagebuilder.Client.exceptions.ServiceQuotaExceededException