Skip to content

/AWS1/IF_ECS=>CREATEEXPRESSGATEWAYSERVICE()

About CreateExpressGatewayService

Creates an Express service that simplifies deploying containerized web applications on Amazon ECS with managed Amazon Web Services infrastructure. This operation provisions and configures Application Load Balancers, target groups, security groups, and auto-scaling policies automatically.

Specify a primary container configuration with your application image and basic settings. Amazon ECS creates the necessary Amazon Web Services resources for traffic distribution, health monitoring, network access control, and capacity management.

Provide an execution role for task operations and an infrastructure role for managing Amazon Web Services resources on your behalf.

Method Signature

METHODS /AWS1/IF_ECS~CREATEEXPRESSGATEWAYSERVICE
  IMPORTING
    !IV_EXECUTIONROLEARN TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_INFRASTRUCTUREROLEARN TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_SERVICENAME TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_CLUSTER TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_HEALTHCHECKPATH TYPE /AWS1/ECSSTRING OPTIONAL
    !IO_PRIMARYCONTAINER TYPE REF TO /AWS1/CL_ECSEXPRESSGWCONTAINER OPTIONAL
    !IV_TASKROLEARN TYPE /AWS1/ECSSTRING OPTIONAL
    !IO_NETWORKCONFIGURATION TYPE REF TO /AWS1/CL_ECSEXPRESSGWSVCNETC00 OPTIONAL
    !IV_CPU TYPE /AWS1/ECSSTRING OPTIONAL
    !IV_MEMORY TYPE /AWS1/ECSSTRING OPTIONAL
    !IO_SCALINGTARGET TYPE REF TO /AWS1/CL_ECSEXPRESSGWSCATARGET OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_ECSTAG=>TT_TAGS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ecscreexpressgwsvcrsp
  RAISING
    /AWS1/CX_ECSACCESSDENIEDEX
    /AWS1/CX_ECSCLIENTEXCEPTION
    /AWS1/CX_ECSCLUSTERNOTFOUNDEX
    /AWS1/CX_ECSINVALIDPARAMETEREX
    /AWS1/CX_ECSPLATFORMTSKDEFIN00
    /AWS1/CX_ECSPLATFORMUNKNOWNEX
    /AWS1/CX_ECSSERVEREXCEPTION
    /AWS1/CX_ECSUNSUPPEDFEATUREEX
    /AWS1/CX_ECSCLIENTEXC
    /AWS1/CX_ECSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_executionrolearn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS container agent permission to make Amazon Web Services API calls on your behalf. This role is required for Amazon ECS to pull container images from Amazon ECR, send container logs to Amazon CloudWatch Logs, and retrieve sensitive data from Amazon Web Services Systems Manager Parameter Store or Amazon Web Services Secrets Manager.

The execution role must include the AmazonECSTaskExecutionRolePolicy managed policy or equivalent permissions. For Express services, this role is used during task startup and runtime for container management operations.

iv_infrastructurerolearn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The Amazon Resource Name (ARN) of the infrastructure role that grants Amazon ECS permission to create and manage Amazon Web Services resources on your behalf for the Express service. This role is used to provision and manage Application Load Balancers, target groups, security groups, auto-scaling policies, and other Amazon Web Services infrastructure components.

The infrastructure role must include permissions for Elastic Load Balancing, Application Auto Scaling, Amazon EC2 (for security groups), and other services required for managed infrastructure. This role is only used during Express service creation, updates, and deletion operations.

io_primarycontainer TYPE REF TO /AWS1/CL_ECSEXPRESSGWCONTAINER /AWS1/CL_ECSEXPRESSGWCONTAINER

The primary container configuration for the Express service. This defines the main application container that will receive traffic from the Application Load Balancer.

The primary container must specify at minimum a container image. You can also configure the container port (defaults to 80), logging configuration, environment variables, secrets, and startup commands. The container image can be from Amazon ECR, Docker Hub, or any other container registry accessible to your execution role.

Optional arguments:

iv_servicename TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The name of the Express service. This name must be unique within the specified cluster and can contain up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens. The name is used to identify the service in the Amazon ECS console and API operations.

If you don't specify a service name, Amazon ECS generates a unique name for the service. The service name becomes part of the service ARN and cannot be changed after the service is created.

iv_cluster TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The short name or full Amazon Resource Name (ARN) of the cluster on which to create the Express service. If you do not specify a cluster, the default cluster is assumed.

iv_healthcheckpath TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The path on the container that the Application Load Balancer uses for health checks. This should be a valid HTTP endpoint that returns a successful response (HTTP 200) when the application is healthy.

If not specified, the default health check path is /ping. The health check path must start with a forward slash and can include query parameters. Examples: /health, /api/status, /ping?format=json.

iv_taskrolearn TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The Amazon Resource Name (ARN) of the IAM role that containers in this task can assume. This role allows your application code to access other Amazon Web Services services securely.

The task role is different from the execution role. While the execution role is used by the Amazon ECS agent to set up the task, the task role is used by your application code running inside the container to make Amazon Web Services API calls. If your application doesn't need to access Amazon Web Services services, you can omit this parameter.

io_networkconfiguration TYPE REF TO /AWS1/CL_ECSEXPRESSGWSVCNETC00 /AWS1/CL_ECSEXPRESSGWSVCNETC00

The network configuration for the Express service tasks. This specifies the VPC subnets and security groups for the tasks.

For Express services, you can specify custom security groups and subnets. If not provided, Amazon ECS will use the default VPC configuration and create appropriate security groups automatically. The network configuration determines how your service integrates with your VPC and what network access it has.

iv_cpu TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The number of CPU units used by the task. This parameter determines the CPU allocation for each task in the Express service. The default value for an Express service is 256 (.25 vCPU).

iv_memory TYPE /AWS1/ECSSTRING /AWS1/ECSSTRING

The amount of memory (in MiB) used by the task. This parameter determines the memory allocation for each task in the Express service. The default value for an express service is 512 MiB.

io_scalingtarget TYPE REF TO /AWS1/CL_ECSEXPRESSGWSCATARGET /AWS1/CL_ECSEXPRESSGWSCATARGET

The auto-scaling configuration for the Express service. This defines how the service automatically adjusts the number of running tasks based on demand.

You can specify the minimum and maximum number of tasks, the scaling metric (CPU utilization, memory utilization, or request count per target), and the target value for the metric. If not specified, the default target value for an Express service is 60.

it_tags TYPE /AWS1/CL_ECSTAG=>TT_TAGS TT_TAGS

The metadata that you apply to the Express service to help categorize and organize it. Each tag consists of a key and an optional value. You can apply up to 50 tags to a service.

RETURNING

oo_output TYPE REF TO /aws1/cl_ecscreexpressgwsvcrsp /AWS1/CL_ECSCREEXPRESSGWSVCRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

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->createexpressgatewayservice(
  io_networkconfiguration = new /aws1/cl_ecsexpressgwsvcnetc00(
    it_securitygroups = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
      ( new /aws1/cl_ecsstringlist_w( |string| ) )
    )
    it_subnets = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
      ( new /aws1/cl_ecsstringlist_w( |string| ) )
    )
  )
  io_primarycontainer = new /aws1/cl_ecsexpressgwcontainer(
    io_awslogsconfiguration = new /aws1/cl_ecsexpressgwsvcawsl00(
      iv_loggroup = |string|
      iv_logstreamprefix = |string|
    )
    io_repositorycredentials = new /aws1/cl_ecsexpressgwrepocreds( |string| )
    it_command = VALUE /aws1/cl_ecsstringlist_w=>tt_stringlist(
      ( new /aws1/cl_ecsstringlist_w( |string| ) )
    )
    it_environment = VALUE /aws1/cl_ecskeyvaluepair=>tt_environmentvariables(
      (
        new /aws1/cl_ecskeyvaluepair(
          iv_name = |string|
          iv_value = |string|
        )
      )
    )
    it_secrets = VALUE /aws1/cl_ecssecret=>tt_secretlist(
      (
        new /aws1/cl_ecssecret(
          iv_name = |string|
          iv_valuefrom = |string|
        )
      )
    )
    iv_containerport = 123
    iv_image = |string|
  )
  io_scalingtarget = new /aws1/cl_ecsexpressgwscatarget(
    iv_autoscalingmetric = |string|
    iv_autoscalingtargetvalue = 123
    iv_maxtaskcount = 123
    iv_mintaskcount = 123
  )
  it_tags = VALUE /aws1/cl_ecstag=>tt_tags(
    (
      new /aws1/cl_ecstag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  iv_cluster = |string|
  iv_cpu = |string|
  iv_executionrolearn = |string|
  iv_healthcheckpath = |string|
  iv_infrastructurerolearn = |string|
  iv_memory = |string|
  iv_servicename = |string|
  iv_taskrolearn = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_ecsexpressgatewayservic = lo_result->get_service( ).
  IF lo_ecsexpressgatewayservic IS NOT INITIAL.
    lv_string = lo_ecsexpressgatewayservic->get_cluster( ).
    lv_string = lo_ecsexpressgatewayservic->get_servicename( ).
    lv_string = lo_ecsexpressgatewayservic->get_servicearn( ).
    lv_string = lo_ecsexpressgatewayservic->get_infrastructurerolearn( ).
    lo_expressgatewayservicest = lo_ecsexpressgatewayservic->get_status( ).
    IF lo_expressgatewayservicest IS NOT INITIAL.
      lv_expressgatewayservicest_1 = lo_expressgatewayservicest->get_statuscode( ).
      lv_string = lo_expressgatewayservicest->get_statusreason( ).
    ENDIF.
    lv_string = lo_ecsexpressgatewayservic->get_currentdeployment( ).
    LOOP AT lo_ecsexpressgatewayservic->get_activeconfigurations( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_string = lo_row_1->get_servicerevisionarn( ).
        lv_string = lo_row_1->get_executionrolearn( ).
        lv_string = lo_row_1->get_taskrolearn( ).
        lv_string = lo_row_1->get_cpu( ).
        lv_string = lo_row_1->get_memory( ).
        lo_expressgatewayservicene = lo_row_1->get_networkconfiguration( ).
        IF lo_expressgatewayservicene IS NOT INITIAL.
          LOOP AT lo_expressgatewayservicene->get_securitygroups( ) into lo_row_2.
            lo_row_3 = lo_row_2.
            IF lo_row_3 IS NOT INITIAL.
              lv_string = lo_row_3->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_expressgatewayservicene->get_subnets( ) into lo_row_2.
            lo_row_3 = lo_row_2.
            IF lo_row_3 IS NOT INITIAL.
              lv_string = lo_row_3->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
        lv_string = lo_row_1->get_healthcheckpath( ).
        lo_expressgatewaycontainer = lo_row_1->get_primarycontainer( ).
        IF lo_expressgatewaycontainer IS NOT INITIAL.
          lv_string = lo_expressgatewaycontainer->get_image( ).
          lv_boxedinteger = lo_expressgatewaycontainer->get_containerport( ).
          lo_expressgatewayserviceaw = lo_expressgatewaycontainer->get_awslogsconfiguration( ).
          IF lo_expressgatewayserviceaw IS NOT INITIAL.
            lv_string = lo_expressgatewayserviceaw->get_loggroup( ).
            lv_string = lo_expressgatewayserviceaw->get_logstreamprefix( ).
          ENDIF.
          lo_expressgatewayrepositor = lo_expressgatewaycontainer->get_repositorycredentials( ).
          IF lo_expressgatewayrepositor IS NOT INITIAL.
            lv_string = lo_expressgatewayrepositor->get_credentialsparameter( ).
          ENDIF.
          LOOP AT lo_expressgatewaycontainer->get_command( ) into lo_row_2.
            lo_row_3 = lo_row_2.
            IF lo_row_3 IS NOT INITIAL.
              lv_string = lo_row_3->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_expressgatewaycontainer->get_environment( ) into lo_row_4.
            lo_row_5 = lo_row_4.
            IF lo_row_5 IS NOT INITIAL.
              lv_string = lo_row_5->get_name( ).
              lv_string = lo_row_5->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_expressgatewaycontainer->get_secrets( ) into lo_row_6.
            lo_row_7 = lo_row_6.
            IF lo_row_7 IS NOT INITIAL.
              lv_string = lo_row_7->get_name( ).
              lv_string = lo_row_7->get_valuefrom( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
        lo_expressgatewayscalingta = lo_row_1->get_scalingtarget( ).
        IF lo_expressgatewayscalingta IS NOT INITIAL.
          lv_boxedinteger = lo_expressgatewayscalingta->get_mintaskcount( ).
          lv_boxedinteger = lo_expressgatewayscalingta->get_maxtaskcount( ).
          lv_expressgatewayservicesc = lo_expressgatewayscalingta->get_autoscalingmetric( ).
          lv_boxedinteger = lo_expressgatewayscalingta->get_autoscalingtargetvalue( ).
        ENDIF.
        LOOP AT lo_row_1->get_ingresspaths( ) into lo_row_8.
          lo_row_9 = lo_row_8.
          IF lo_row_9 IS NOT INITIAL.
            lv_accesstype = lo_row_9->get_accesstype( ).
            lv_string = lo_row_9->get_endpoint( ).
          ENDIF.
        ENDLOOP.
        lv_timestamp = lo_row_1->get_createdat( ).
      ENDIF.
    ENDLOOP.
    LOOP AT lo_ecsexpressgatewayservic->get_tags( ) into lo_row_10.
      lo_row_11 = lo_row_10.
      IF lo_row_11 IS NOT INITIAL.
        lv_tagkey = lo_row_11->get_key( ).
        lv_tagvalue = lo_row_11->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_timestamp = lo_ecsexpressgatewayservic->get_createdat( ).
    lv_timestamp = lo_ecsexpressgatewayservic->get_updatedat( ).
  ENDIF.
ENDIF.