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', ] }, 'imageScanningTypes': [ 'TEST_INSTANCE_CVE'|'ON_DEMAND_AMI_CVE', ], 'scanResultCondition': { 'maximumSeverityLabel': 'INFORMATIONAL'|'LOW'|'MEDIUM'|'HIGH', 'fixAvailable': True|False } }, 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) –
The settings that determine whether and how Amazon Inspector scans the image for vulnerabilities.
imageScanningEnabled (boolean) –
Specifies whether Amazon Inspector scans for vulnerabilities when you create a new image. You must also enable image tests. For AMI output,
imageScanningTypessets whether Amazon Inspector scans the test instance or the output AMI. For container output, Amazon Inspector scans the container image that Image Builder pushes to the Amazon ECR repository from yourecrConfigurationsettings.To use container image scans, you must activate Amazon Inspector for Amazon ECR scanning in your account. The Image Builder
ListImageScanFindingsoperation returns the findings of these scans.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) –
imageScanningTypes (list) –
The type of vulnerability scan that Image Builder runs for AMI output when
imageScanningEnabledistrue. Specify a single value. If you omitimageScanningTypes, Image Builder usesTEST_INSTANCE_CVE. The scan types work as follows:With
TEST_INSTANCE_CVE, Amazon Inspector scans the test instance during image tests. To use this scan, you must activate Amazon Inspector for Amazon EC2 scanning in your account. The Image BuilderListImageScanFindingsoperation returns the findings.With
ON_DEMAND_AMI_CVE, Amazon Inspector starts an on-demand scan of the output AMI during image tests. To use this scan, you must build from an image recipe, but you do not need to activate Amazon Inspector in your account. The Amazon EC2 GetImageFindings operation returns the findings.
(string) –
scanResultCondition (dict) –
The condition that the output AMI’s scan results must meet for the image to pass. You can set
scanResultConditiononly whenimageScanningTypesisON_DEMAND_AMI_CVE. If you omit it, Image Builder starts the scan but does not wait for it or use its results to pass or fail the image.When you set
scanResultCondition, the test phase waits for the scan to finish. Then Image Builder checks the findings against the condition. By default, Image Builder counts only findings that have a fix available. To count every finding, setfixAvailabletofalse. If a counted finding exceedsmaximumSeverityLabel, Image Builder fails the image in the test phase and does not distribute the AMI.maximumSeverityLabel (string) – [REQUIRED]
The maximum severity allowed for findings on the output AMI. A finding above this severity fails the image, unless
fixAvailableexcludes it. Valid values areINFORMATIONAL,LOW,MEDIUM, andHIGH. ACRITICALfinding that counts always fails the image.fixAvailable (boolean) –
Specifies whether only findings that have a fix available count toward
maximumSeverityLabel. Whenfalse, Image Builder counts every finding. The default istrue.
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