Skip to content

/AWS1/IF_IMG=>CREATEDISTRIBUTIONCONF()

About CreateDistributionConfiguration

Creates a new distribution configuration. Distribution configurations define and configure the outputs for your images, including the target Regions, accounts, and settings for each Region.

Method Signature

METHODS /AWS1/IF_IMG~CREATEDISTRIBUTIONCONF
  IMPORTING
    !IV_NAME TYPE /AWS1/IMGRESOURCENAME OPTIONAL
    !IV_DESCRIPTION TYPE /AWS1/IMGNONEMPTYSTRING OPTIONAL
    !IT_DISTRIBUTIONS TYPE /AWS1/CL_IMGDISTRIBUTION=>TT_DISTRIBUTIONLIST OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_IMGTAGMAP_W=>TT_TAGMAP OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/IMGCLIENTTOKEN OPTIONAL
    !IV_DRYRUN TYPE /AWS1/IMGBOOLEAN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_imgcredistributionc01
  RAISING
    /AWS1/CX_IMGCALLRLIMEXCEEDEDEX
    /AWS1/CX_IMGCLIENTEXCEPTION
    /AWS1/CX_IMGDRYRUNOPERATIONEX
    /AWS1/CX_IMGFORBIDDENEXCEPTION
    /AWS1/CX_IMGIDEMPOTENTPRMMIS00
    /AWS1/CX_IMGINVPRMCOMBINATIO00
    /AWS1/CX_IMGINVALIDREQUESTEX
    /AWS1/CX_IMGRESRCALRDYEXISTSEX
    /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_name TYPE /AWS1/IMGRESOURCENAME /AWS1/IMGRESOURCENAME

The name of the distribution configuration. Distribution configuration names must be unique to your account in each Amazon Web Services Region. Image Builder generates the distribution configuration ARN from a normalized form of the name, so names that differ only in case, spaces, or underscores count as the same name.

it_distributions TYPE /AWS1/CL_IMGDISTRIBUTION=>TT_DISTRIBUTIONLIST TT_DISTRIBUTIONLIST

The distribution settings for the configuration. Each entry defines how output images are distributed in one target Amazon Web Services Region. A Region can appear at most once in the list.

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 distribution configuration.

it_tags TYPE /AWS1/CL_IMGTAGMAP_W=>TT_TAGMAP TT_TAGMAP

The tags of the distribution configuration.

iv_dryrun TYPE /AWS1/IMGBOOLEAN /AWS1/IMGBOOLEAN

Validates the required permissions and request parameters without performing the operation. If validation succeeds, the operation returns a DryRunOperationException error response.

RETURNING

oo_output TYPE REF TO /aws1/cl_imgcredistributionc01 /AWS1/CL_IMGCREDISTRIBUTIONC01

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->createdistributionconf(
  it_distributions = VALUE /aws1/cl_imgdistribution=>tt_distributionlist(
    (
      new /aws1/cl_imgdistribution(
        io_amidistributionconf = new /aws1/cl_imgamidistributionc00(
          io_launchpermission = new /aws1/cl_imglaunchpermconf(
            it_organizationalunitarns = VALUE /aws1/cl_imgorgalunitarnlist_w=>tt_organizationalunitarnlist(
              ( new /aws1/cl_imgorgalunitarnlist_w( |string| ) )
            )
            it_organizationarns = VALUE /aws1/cl_imgorgarnlist_w=>tt_organizationarnlist(
              ( new /aws1/cl_imgorgarnlist_w( |string| ) )
            )
            it_usergroups = VALUE /aws1/cl_imgstringlist_w=>tt_stringlist(
              ( new /aws1/cl_imgstringlist_w( |string| ) )
            )
            it_userids = VALUE /aws1/cl_imgaccountlist_w=>tt_accountlist(
              ( new /aws1/cl_imgaccountlist_w( |string| ) )
            )
          )
          it_amitags = 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_targetaccountids = VALUE /aws1/cl_imgaccountlist_w=>tt_accountlist(
            ( new /aws1/cl_imgaccountlist_w( |string| ) )
          )
          iv_description = |string|
          iv_kmskeyid = |string|
          iv_name = |string|
        )
        io_containerdistributionconf = new /aws1/cl_imgcontainerdistrib00(
          io_targetrepository = new /aws1/cl_imgtgtcontainerrepo00(
            iv_repositoryname = |string|
            iv_service = |string|
          )
          it_containertags = VALUE /aws1/cl_imgstringlist_w=>tt_stringlist(
            ( new /aws1/cl_imgstringlist_w( |string| ) )
          )
          iv_description = |string|
        )
        io_s3exportconfiguration = new /aws1/cl_imgs3exportconf(
          iv_diskimageformat = |string|
          iv_rolename = |string|
          iv_s3bucket = |string|
          iv_s3prefix = |string|
        )
        it_fastlaunchconfigurations = VALUE /aws1/cl_imgfastlaunchconf=>tt_fastlaunchconfigurationlist(
          (
            new /aws1/cl_imgfastlaunchconf(
              io_launchtemplate = new /aws1/cl_imgfastlaunchlaunch00(
                iv_launchtemplateid = |string|
                iv_launchtemplatename = |string|
                iv_launchtemplateversion = |string|
              )
              io_snapshotconfiguration = new /aws1/cl_imgfastlaunchsnapconf( 123 )
              iv_accountid = |string|
              iv_enabled = ABAP_TRUE
              iv_maxparallellaunches = 123
            )
          )
        )
        it_launchtemplateconfs = VALUE /aws1/cl_imglaunchtemplateconf=>tt_launchtemplateconflist(
          (
            new /aws1/cl_imglaunchtemplateconf(
              iv_accountid = |string|
              iv_launchtemplateid = |string|
              iv_setdefaultversion = ABAP_TRUE
            )
          )
        )
        it_licenseconfigurationarns = VALUE /aws1/cl_imglicenseconfarnls00=>tt_licenseconfigurationarnlist(
          ( new /aws1/cl_imglicenseconfarnls00( |string| ) )
        )
        it_ssmparameterconfs = VALUE /aws1/cl_imgssmparameterconf=>tt_ssmparameterconflist(
          (
            new /aws1/cl_imgssmparameterconf(
              iv_amiaccountid = |string|
              iv_datatype = |string|
              iv_parametername = |string|
            )
          )
        )
        iv_region = |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_description = |string|
  iv_dryrun = ABAP_TRUE
  iv_name = |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_distributionconfigurati = lo_result->get_distributionconfarn( ).
ENDIF.

Create a distribution configuration

The following example creates a distribution configuration that distributes the output AMI to two Regions. The AMI name includes the build date, so that repeated builds create unique AMI names.

DATA(lo_result) = lo_client->createdistributionconf(
  it_distributions = VALUE /aws1/cl_imgdistribution=>tt_distributionlist(
    (
      new /aws1/cl_imgdistribution(
        io_amidistributionconf = new /aws1/cl_imgamidistributionc00( iv_name = |my-example-image-{{ imagebuilder:buildDate }}| )
        iv_region = |us-west-2|
      )
    )
    (
      new /aws1/cl_imgdistribution(
        io_amidistributionconf = new /aws1/cl_imgamidistributionc00( iv_name = |my-example-image-{{ imagebuilder:buildDate }}| )
        iv_region = |us-east-1|
      )
    )
  )
  iv_clienttoken = |a1b2c3d4-5678-90ab-cdef-EXAMPLE44444|
  iv_description = |Copies the output AMI to a second Region|
  iv_name = |my-example-distribution|
).

Create a distribution configuration with launch permissions and a launch template update

The following example creates a distribution configuration that distributes the output AMI to two Regions. In us-east-1, it shares the AMI with another AWS account. In us-west-2, it sets the new AMI as the default version of your launch template.

DATA(lo_result) = lo_client->createdistributionconf(
  it_distributions = VALUE /aws1/cl_imgdistribution=>tt_distributionlist(
    (
      new /aws1/cl_imgdistribution(
        io_amidistributionconf = new /aws1/cl_imgamidistributionc00( iv_name = |my-example-image-{{ imagebuilder:buildDate }}| )
        it_launchtemplateconfs = VALUE /aws1/cl_imglaunchtemplateconf=>tt_launchtemplateconflist(
          (
            new /aws1/cl_imglaunchtemplateconf(
              iv_launchtemplateid = |lt-1234567890abcdef0|
              iv_setdefaultversion = ABAP_TRUE
            )
          )
        )
        iv_region = |us-west-2|
      )
    )
    (
      new /aws1/cl_imgdistribution(
        io_amidistributionconf = new /aws1/cl_imgamidistributionc00(
          io_launchpermission = new /aws1/cl_imglaunchpermconf(
            it_userids = VALUE /aws1/cl_imgaccountlist_w=>tt_accountlist(
              ( new /aws1/cl_imgaccountlist_w( |444455556666| ) )
            )
          )
          iv_name = |my-example-image-{{ imagebuilder:buildDate }}|
        )
        iv_region = |us-east-1|
      )
    )
  )
  iv_clienttoken = |a1b2c3d4-5678-90ab-cdef-EXAMPLE56789|
  iv_description = |Distributes the output AMI to two Regions and shares it with another account|
  iv_name = |my-example-distribution|
).