/AWS1/IF_IMG=>CREATEIMAGE()¶
About CreateImage¶
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 containerRecipeArn or an imageRecipeArn.
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.
Method Signature¶
METHODS /AWS1/IF_IMG~CREATEIMAGE
IMPORTING
!IV_IMAGERECIPEARN TYPE /AWS1/IMGIMAGERECIPEARN OPTIONAL
!IV_CONTAINERRECIPEARN TYPE /AWS1/IMGCONTAINERRECIPEARN OPTIONAL
!IV_DISTRIBUTIONCONFARN TYPE /AWS1/IMGDISTRIBUTIONCONFARN OPTIONAL
!IV_INFRASTRUCTURECONFARN TYPE /AWS1/IMGINFRASTRUCTURECONFARN OPTIONAL
!IO_IMAGETESTSCONFIGURATION TYPE REF TO /AWS1/CL_IMGIMAGETESTSCONF OPTIONAL
!IV_ENHANCEDIMAGEMETENABLED TYPE /AWS1/IMGNULLABLEBOOLEAN OPTIONAL
!IT_TAGS TYPE /AWS1/CL_IMGTAGMAP_W=>TT_TAGMAP OPTIONAL
!IV_CLIENTTOKEN TYPE /AWS1/IMGCLIENTTOKEN OPTIONAL
!IO_IMAGESCANNINGCONF TYPE REF TO /AWS1/CL_IMGIMAGESCANNINGCONF OPTIONAL
!IT_WORKFLOWS TYPE /AWS1/CL_IMGWORKFLOWCONF=>TT_WORKFLOWCONFIGURATIONLIST OPTIONAL
!IV_EXECUTIONROLE TYPE /AWS1/IMGROLENAMEORARN OPTIONAL
!IO_LOGGINGCONFIGURATION TYPE REF TO /AWS1/CL_IMGIMAGELOGGINGCONF OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_imgcreateimagersp
RAISING
/AWS1/CX_IMGCALLRLIMEXCEEDEDEX
/AWS1/CX_IMGCLIENTEXCEPTION
/AWS1/CX_IMGFORBIDDENEXCEPTION
/AWS1/CX_IMGIDEMPOTENTPRMMIS00
/AWS1/CX_IMGINVALIDREQUESTEX
/AWS1/CX_IMGRESOURCEINUSEEX
/AWS1/CX_IMGSERVICEEXCEPTION
/AWS1/CX_IMGSERVICEQUOTAEXCDEX
/AWS1/CX_IMGSERVICEUNAVAILEX
/AWS1/CX_IMGCLIENTEXC
/AWS1/CX_IMGSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_infrastructureconfarn TYPE /AWS1/IMGINFRASTRUCTURECONFARN /AWS1/IMGINFRASTRUCTURECONFARN¶
The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your image will be built and tested.
iv_clienttoken TYPE /AWS1/IMGCLIENTTOKEN /AWS1/IMGCLIENTTOKEN¶
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.
Optional arguments:¶
iv_imagerecipearn TYPE /AWS1/IMGIMAGERECIPEARN /AWS1/IMGIMAGERECIPEARN¶
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.
iv_containerrecipearn TYPE /AWS1/IMGCONTAINERRECIPEARN /AWS1/IMGCONTAINERRECIPEARN¶
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.
iv_distributionconfarn TYPE /AWS1/IMGDISTRIBUTIONCONFARN /AWS1/IMGDISTRIBUTIONCONFARN¶
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.
io_imagetestsconfiguration TYPE REF TO /AWS1/CL_IMGIMAGETESTSCONF /AWS1/CL_IMGIMAGETESTSCONF¶
Settings that determine whether Image Builder runs tests on the image after building it. Image tests are enabled by default.
iv_enhancedimagemetenabled TYPE /AWS1/IMGNULLABLEBOOLEAN /AWS1/IMGNULLABLEBOOLEAN¶
Specifies whether to collect additional information about the image being created, including the operating system (OS) version and package list. Defaults to
true.
it_tags TYPE /AWS1/CL_IMGTAGMAP_W=>TT_TAGMAP TT_TAGMAP¶
The tags of the image.
io_imagescanningconf TYPE REF TO /AWS1/CL_IMGIMAGESCANNINGCONF /AWS1/CL_IMGIMAGESCANNINGCONF¶
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.
it_workflows TYPE /AWS1/CL_IMGWORKFLOWCONF=>TT_WORKFLOWCONFIGURATIONLIST TT_WORKFLOWCONFIGURATIONLIST¶
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.
iv_executionrole TYPE /AWS1/IMGROLENAMEORARN /AWS1/IMGROLENAMEORARN¶
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.
io_loggingconfiguration TYPE REF TO /AWS1/CL_IMGIMAGELOGGINGCONF /AWS1/CL_IMGIMAGELOGGINGCONF¶
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.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_imgcreateimagersp /AWS1/CL_IMGCREATEIMAGERSP¶
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->createimage(
io_imagescanningconf = new /aws1/cl_imgimagescanningconf(
io_ecrconfiguration = new /aws1/cl_imgecrconfiguration(
it_containertags = VALUE /aws1/cl_imgstringlist_w=>tt_stringlist(
( new /aws1/cl_imgstringlist_w( |string| ) )
)
iv_repositoryname = |string|
)
iv_imagescanningenabled = ABAP_TRUE
)
io_imagetestsconfiguration = new /aws1/cl_imgimagetestsconf(
iv_imagetestsenabled = ABAP_TRUE
iv_timeoutminutes = 123
)
io_loggingconfiguration = new /aws1/cl_imgimageloggingconf( |string| )
it_tags = VALUE /aws1/cl_imgtagmap_w=>tt_tagmap(
(
VALUE /aws1/cl_imgtagmap_w=>ts_tagmap_maprow(
key = |string|
value = new /aws1/cl_imgtagmap_w( |string| )
)
)
)
it_workflows = VALUE /aws1/cl_imgworkflowconf=>tt_workflowconfigurationlist(
(
new /aws1/cl_imgworkflowconf(
it_parameters = VALUE /aws1/cl_imgworkflowparameter=>tt_workflowparameterlist(
(
new /aws1/cl_imgworkflowparameter(
it_value = VALUE /aws1/cl_imgworkflowprmvalls00=>tt_workflowparametervaluelist(
( new /aws1/cl_imgworkflowprmvalls00( |string| ) )
)
iv_name = |string|
)
)
)
iv_onfailure = |string|
iv_parallelgroup = |string|
iv_workflowarn = |string|
)
)
)
iv_clienttoken = |string|
iv_containerrecipearn = |string|
iv_distributionconfarn = |string|
iv_enhancedimagemetenabled = ABAP_TRUE
iv_executionrole = |string|
iv_imagerecipearn = |string|
iv_infrastructureconfarn = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_nonemptystring = lo_result->get_requestid( ).
lv_clienttoken = lo_result->get_clienttoken( ).
lv_imagebuildversionarn = lo_result->get_imagebuildversionarn( ).
lo_latestversionreferences = lo_result->get_latestversionreferences( ).
IF lo_latestversionreferences IS NOT INITIAL.
lv_imagebuilderarn = lo_latestversionreferences->get_latestversionarn( ).
lv_imagebuilderarn = lo_latestversionreferences->get_latestmajorversionarn( ).
lv_imagebuilderarn = lo_latestversionreferences->get_latestminorversionarn( ).
lv_imagebuilderarn = lo_latestversionreferences->get_latestpatchversionarn( ).
ENDIF.
ENDIF.
Create an image¶
The following example creates a new image from the specified image recipe and infrastructure configuration.
DATA(lo_result) = lo_client->createimage(
iv_clienttoken = |a1b2c3d4-5678-90ab-cdef-EXAMPLEeeeee|
iv_imagerecipearn = |arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.0.0|
iv_infrastructureconfarn = |arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure|
).
Create an image with custom build and parallel test workflows¶
The following example creates an image that uses your custom build and test workflows. It uses the Image Builder service-linked role as the execution role. Both test workflows are in the same parallel group, so they can run at the same time after the build workflow completes.
DATA(lo_result) = lo_client->createimage(
it_workflows = VALUE /aws1/cl_imgworkflowconf=>tt_workflowconfigurationlist(
( new /aws1/cl_imgworkflowconf( iv_workflowarn = |arn:aws:imagebuilder:us-west-2:111122223333:workflow/build/my-example-workflow/1.0.0/1| ) )
(
new /aws1/cl_imgworkflowconf(
iv_parallelgroup = |post-build-tests|
iv_workflowarn = |arn:aws:imagebuilder:us-west-2:111122223333:workflow/test/my-example-integration-tests/1.0.0/1|
)
)
(
new /aws1/cl_imgworkflowconf(
iv_parallelgroup = |post-build-tests|
iv_workflowarn = |arn:aws:imagebuilder:us-west-2:111122223333:workflow/test/my-example-compliance-tests/1.0.0/1|
)
)
)
iv_clienttoken = |a1b2c3d4-5678-90ab-cdef-EXAMPLE01234|
iv_executionrole = |arn:aws:iam::111122223333:role/aws-service-role/imagebuilder.amazonaws.com/AWSServiceRoleForImageBuilder|
iv_imagerecipearn = |arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.0.0|
iv_infrastructureconfarn = |arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure|
).