Skip to content

/AWS1/IF_IMG=>UPDATEINFRASTRUCTURECONF()

About UpdateInfrastructureConfiguration

Updates an infrastructure configuration. An infrastructure configuration defines the environment in which Image Builder builds and tests your image.

This operation doesn't support selective updates. The request replaces the configuration, so include every setting that you want to keep. Omitted optional properties are cleared.

Method Signature

METHODS /AWS1/IF_IMG~UPDATEINFRASTRUCTURECONF
  IMPORTING
    !IV_INFRASTRUCTURECONFARN TYPE /AWS1/IMGINFRASTRUCTURECONFARN OPTIONAL
    !IV_DESCRIPTION TYPE /AWS1/IMGNONEMPTYSTRING OPTIONAL
    !IT_INSTANCETYPES TYPE /AWS1/CL_IMGINSTANCETYPELIST_W=>TT_INSTANCETYPELIST OPTIONAL
    !IV_INSTANCEPROFILENAME TYPE /AWS1/IMGINSTPROFILENAMETYPE OPTIONAL
    !IT_SECURITYGROUPIDS TYPE /AWS1/CL_IMGSECURITYGROUPIDS_W=>TT_SECURITYGROUPIDS OPTIONAL
    !IV_SUBNETID TYPE /AWS1/IMGNONEMPTYSTRING OPTIONAL
    !IO_LOGGING TYPE REF TO /AWS1/CL_IMGLOGGING OPTIONAL
    !IV_KEYPAIR TYPE /AWS1/IMGNONEMPTYSTRING OPTIONAL
    !IV_TERMINATEINSTONFAILURE TYPE /AWS1/IMGNULLABLEBOOLEAN OPTIONAL
    !IV_TERMINSTANCEONCOMPLTN TYPE /AWS1/IMGNULLABLEBOOLEAN OPTIONAL
    !IV_SNSTOPICARN TYPE /AWS1/IMGSNSTOPICARN OPTIONAL
    !IT_RESOURCETAGS TYPE /AWS1/CL_IMGRESOURCETAGMAP_W=>TT_RESOURCETAGMAP OPTIONAL
    !IO_INSTANCEMETADATAOPTIONS TYPE REF TO /AWS1/CL_IMGINSTANCEMETOPTIONS OPTIONAL
    !IO_PLACEMENT TYPE REF TO /AWS1/CL_IMGPLACEMENT OPTIONAL
    !IO_PARENTINSTANCE TYPE REF TO /AWS1/CL_IMGPARENTINSTANCECONF OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/IMGCLIENTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_imgupinfrastructure01
  RAISING
    /AWS1/CX_IMGCALLRLIMEXCEEDEDEX
    /AWS1/CX_IMGCLIENTEXCEPTION
    /AWS1/CX_IMGFORBIDDENEXCEPTION
    /AWS1/CX_IMGIDEMPOTENTPRMMIS00
    /AWS1/CX_IMGINVALIDREQUESTEX
    /AWS1/CX_IMGRESOURCEINUSEEX
    /AWS1/CX_IMGSERVICEEXCEPTION
    /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 you want to update.

iv_instanceprofilename TYPE /AWS1/IMGINSTPROFILENAMETYPE /AWS1/IMGINSTPROFILENAMETYPE

The instance profile to associate with the instance used to customize your Amazon EC2 AMI. The instance profile must exist in your account.

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_description TYPE /AWS1/IMGNONEMPTYSTRING /AWS1/IMGNONEMPTYSTRING

The description of the infrastructure configuration.

it_instancetypes TYPE /AWS1/CL_IMGINSTANCETYPELIST_W=>TT_INSTANCETYPELIST TT_INSTANCETYPELIST

The instance types of the infrastructure configuration. You can specify one or more instance types to use for this build. Image Builder picks one of these instance types based on availability. If you don't specify instance types, Image Builder selects compatible instance types automatically. If you specify a Dedicated Host, Image Builder uses only instance types that the host supports.

it_securitygroupids TYPE /AWS1/CL_IMGSECURITYGROUPIDS_W=>TT_SECURITYGROUPIDS TT_SECURITYGROUPIDS

The security group IDs to associate with the instance used to customize your Amazon EC2 AMI.

iv_subnetid TYPE /AWS1/IMGNONEMPTYSTRING /AWS1/IMGNONEMPTYSTRING

The subnet ID in which to place the instance used to customize your Amazon EC2 AMI. If you specify subnetId, you must also specify one or more security group IDs in securityGroupIds. Otherwise, the request fails.

io_logging TYPE REF TO /AWS1/CL_IMGLOGGING /AWS1/CL_IMGLOGGING

The logging configuration of the infrastructure configuration. When you configure S3 logs, Image Builder writes logs from the build and test process to the specified bucket under the key prefix.

iv_keypair TYPE /AWS1/IMGNONEMPTYSTRING /AWS1/IMGNONEMPTYSTRING

The key pair of the infrastructure configuration. You can use this to log on to and debug the instance used to create your image.

iv_terminateinstonfailure TYPE /AWS1/IMGNULLABLEBOOLEAN /AWS1/IMGNULLABLEBOOLEAN

Specifies whether to terminate the instance on failure. Set to false if you want Image Builder to retain the instance used to configure your AMI if the build or test phase of your workflow fails. Defaults to true.

iv_terminstanceoncompltn TYPE /AWS1/IMGNULLABLEBOOLEAN /AWS1/IMGNULLABLEBOOLEAN

Specifies whether Image Builder terminates build and test instances when image creation ends without a failure (success, cancellation, or expiration). Defaults to true.

iv_snstopicarn TYPE /AWS1/IMGSNSTOPICARN /AWS1/IMGSNSTOPICARN

The Amazon Resource Name (ARN) of the SNS topic to which Image Builder sends image build event notifications. Specify a standard topic. Image Builder doesn't support FIFO topics. Image Builder validates the topic when you create or update the configuration. You must have permission to publish to the topic.

EC2 Image Builder can't send notifications to SNS topics that are encrypted using keys from other accounts. If your SNS topic is encrypted, the key must be owned by the same account that owns your Image Builder resources.

it_resourcetags TYPE /AWS1/CL_IMGRESOURCETAGMAP_W=>TT_RESOURCETAGMAP TT_RESOURCETAGMAP

The metadata tags to assign to the Amazon EC2 instance that Image Builder launches during the build process. Tags are formatted as key value pairs. Tag keys can't begin with aws: or match one of the following reserved keys: CreatedBy, Ec2ImageBuilderArn, Name, or Tags.

io_instancemetadataoptions TYPE REF TO /AWS1/CL_IMGINSTANCEMETOPTIONS /AWS1/CL_IMGINSTANCEMETOPTIONS

The instance metadata service (IMDS) settings that Image Builder applies to the EC2 build and test instances it launches during image creation. If you don't set these options, the EC2 launch defaults for the instance apply. For more information about instance metadata options, see one of the following links:

io_placement TYPE REF TO /AWS1/CL_IMGPLACEMENT /AWS1/CL_IMGPLACEMENT

The instance placement settings that define where the build and test instances that Image Builder launches during image creation run. These settings don't affect instances that you launch from the output image.

io_parentinstance TYPE REF TO /AWS1/CL_IMGPARENTINSTANCECONF /AWS1/CL_IMGPARENTINSTANCECONF

The Amazon EC2 Auto Scaling group that Image Builder takes the build instance from, instead of launching a new instance. This applies only to the build phase.

To use this feature, the execution role for the build must have permissions to describe the Auto Scaling group, tag the instance while it's still in the group, and detach it from the group. For more information, see Build on an instance from an Auto Scaling group in the EC2 Image Builder User Guide.

RETURNING

oo_output TYPE REF TO /aws1/cl_imgupinfrastructure01 /AWS1/CL_IMGUPINFRASTRUCTURE01

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->updateinfrastructureconf(
  io_instancemetadataoptions = new /aws1/cl_imginstancemetoptions(
    iv_httpputresponsehoplimit = 123
    iv_httptokens = |string|
  )
  io_logging = new /aws1/cl_imglogging(
    io_s3logs = new /aws1/cl_imgs3logs(
      iv_s3bucketname = |string|
      iv_s3keyprefix = |string|
    )
  )
  io_parentinstance = new /aws1/cl_imgparentinstanceconf(
    io_autoscalinggroup = new /aws1/cl_imgautoscgroupconf(
      iv_capwaittimeoutseconds = 123
      iv_name = |string|
    )
  )
  io_placement = new /aws1/cl_imgplacement(
    iv_availabilityzone = |string|
    iv_hostid = |string|
    iv_hostresourcegrouparn = |string|
    iv_tenancy = |string|
  )
  it_instancetypes = VALUE /aws1/cl_imginstancetypelist_w=>tt_instancetypelist(
    ( new /aws1/cl_imginstancetypelist_w( |string| ) )
  )
  it_resourcetags = VALUE /aws1/cl_imgresourcetagmap_w=>tt_resourcetagmap(
    (
      VALUE /aws1/cl_imgresourcetagmap_w=>ts_resourcetagmap_maprow(
        key = |string|
        value = new /aws1/cl_imgresourcetagmap_w( |string| )
      )
    )
  )
  it_securitygroupids = VALUE /aws1/cl_imgsecuritygroupids_w=>tt_securitygroupids(
    ( new /aws1/cl_imgsecuritygroupids_w( |string| ) )
  )
  iv_clienttoken = |string|
  iv_description = |string|
  iv_infrastructureconfarn = |string|
  iv_instanceprofilename = |string|
  iv_keypair = |string|
  iv_snstopicarn = |string|
  iv_subnetid = |string|
  iv_terminateinstonfailure = ABAP_TRUE
  iv_terminstanceoncompltn = ABAP_TRUE
).

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_infrastructureconfigura = lo_result->get_infrastructureconfarn( ).
ENDIF.

Update an infrastructure configuration

The following example updates an infrastructure configuration to use larger instance types and to keep the build instance running when the image build fails.

DATA(lo_result) = lo_client->updateinfrastructureconf(
  it_instancetypes = VALUE /aws1/cl_imginstancetypelist_w=>tt_instancetypelist(
    ( new /aws1/cl_imginstancetypelist_w( |t3.large| ) )
    ( new /aws1/cl_imginstancetypelist_w( |t3.xlarge| ) )
  )
  iv_clienttoken = |a1b2c3d4-5678-90ab-cdef-EXAMPLEbbbbb|
  iv_description = |An infrastructure configuration for Amazon Linux builds|
  iv_infrastructureconfarn = |arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure|
  iv_instanceprofilename = |EC2InstanceProfileForImageBuilder|
  iv_terminateinstonfailure = ABAP_FALSE
).