Skip to content

/AWS1/IF_IMG=>DISTRIBUTEIMAGE()

About DistributeImage

Distributes an existing AMI to target Regions and accounts without running the full image build process. This operation only runs the distribution phase on an image that has already been built.

Method Signature

METHODS /AWS1/IF_IMG~DISTRIBUTEIMAGE
  IMPORTING
    !IV_SOURCEIMAGE TYPE /AWS1/IMGNONEMPTYSTRING OPTIONAL
    !IV_DISTRIBUTIONCONFARN TYPE /AWS1/IMGDISTRIBUTIONCONFARN OPTIONAL
    !IV_EXECUTIONROLE TYPE /AWS1/IMGROLENAMEORARN OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_IMGTAGMAP_W=>TT_TAGMAP OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/IMGCLIENTTOKEN OPTIONAL
    !IO_LOGGINGCONFIGURATION TYPE REF TO /AWS1/CL_IMGIMAGELOGGINGCONF OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_imgdistributeimagersp
  RAISING
    /AWS1/CX_IMGACCESSDENIEDEX
    /AWS1/CX_IMGCALLRLIMEXCEEDEDEX
    /AWS1/CX_IMGCLIENTEXCEPTION
    /AWS1/CX_IMGFORBIDDENEXCEPTION
    /AWS1/CX_IMGIDEMPOTENTPRMMIS00
    /AWS1/CX_IMGINVALIDREQUESTEX
    /AWS1/CX_IMGRESOURCEINUSEEX
    /AWS1/CX_IMGRESOURCENOTFOUNDEX
    /AWS1/CX_IMGSERVICEEXCEPTION
    /AWS1/CX_IMGSERVICEQUOTAEXCDEX
    /AWS1/CX_IMGSERVICEUNAVAILEX
    /AWS1/CX_IMGTOOMANYREQUESTSEX
    /AWS1/CX_IMGCLIENTEXC
    /AWS1/CX_IMGSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_sourceimage TYPE /AWS1/IMGNONEMPTYSTRING /AWS1/IMGNONEMPTYSTRING

The source image to distribute. Specify an AMI identifier, SSM parameter path, or Image Builder image Amazon Resource Name (ARN). When you specify an Image Builder image Amazon Resource Name (ARN), the image must be in the AVAILABLE state.

iv_distributionconfarn TYPE /AWS1/IMGDISTRIBUTIONCONFARN /AWS1/IMGDISTRIBUTIONCONFARN

The Amazon Resource Name (ARN) of the distribution configuration. The configuration defines target Regions, accounts, and AMI settings. The distribution configuration must be in the same Region as this operation.

iv_executionrole TYPE /AWS1/IMGROLENAMEORARN /AWS1/IMGROLENAMEORARN

The name or Amazon Resource Name (ARN) of the IAM role that Image Builder assumes to distribute the image.

iv_clienttoken TYPE /AWS1/IMGCLIENTTOKEN /AWS1/IMGCLIENTTOKEN

Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.

Optional arguments:

it_tags TYPE /AWS1/CL_IMGTAGMAP_W=>TT_TAGMAP TT_TAGMAP

The tags to apply to the distributed image.

io_loggingconfiguration TYPE REF TO /AWS1/CL_IMGIMAGELOGGINGCONF /AWS1/CL_IMGIMAGELOGGINGCONF

The logging configuration for the distribution.

RETURNING

oo_output TYPE REF TO /aws1/cl_imgdistributeimagersp /AWS1/CL_IMGDISTRIBUTEIMAGERSP

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->distributeimage(
  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| )
      )
    )
  )
  iv_clienttoken = |string|
  iv_distributionconfarn = |string|
  iv_executionrole = |string|
  iv_sourceimage = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_clienttoken = lo_result->get_clienttoken( ).
  lv_imagebuildversionarn = lo_result->get_imagebuildversionarn( ).
ENDIF.