ECS / Client / create_gateway

create_gateway

ECS.Client.create_gateway(**kwargs)

Creates a gateway. A gateway defines and dynamically manages ingress paths for your Amazon ECS services, handling traffic routing and infrastructure across multiple services while optimizing infrastructure usage. CreateGateway is a synchronous operation and the gateway is returned with a status of ACTIVE. The load balancers and other infrastructure that a gateway manages aren’t created until a service in an associated cluster begins using the gateway.

To use this operation, you must have the iam:PassRole permission for the infrastructure role that you specify in infrastructureRoleArn.

See also: AWS API Documentation

Request Syntax

response = client.create_gateway(
    name='string',
    infrastructureRoleArn='string',
    clientToken='string',
    deletionProtection=True|False,
    configuration={
        'hostSharedAlb': {
            'networkConfiguration': {
                'inboundSecurityGroup': 'string',
                'subnets': [
                    'string',
                ],
                'ipAddressType': 'ipv4'|'dualstack'|'dualstack-without-public-ipv4'
            },
            'scheme': 'internet-facing'|'internal',
            'webACLArn': 'string',
            'accessLogs': {
                'destination': {
                    's3': {
                        'bucket': 'string',
                        'prefix': 'string'
                    }
                }
            },
            'port': 123,
            'protocol': 'HTTP'|'HTTPS',
            'maxAlbCount': 123,
            'httpDesync': 'monitor'|'defensive'|'strictest',
            'testTrafficRules': {
                'header': {
                    'name': 'string',
                    'values': [
                        'string',
                    ]
                }
            }
        }
    },
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    propagateTags='NONE'|'GATEWAY'
)
Parameters:
  • name (string) –

    [REQUIRED]

    The name for the gateway. The name must be unique within your account and can be up to 255 characters.

  • infrastructureRoleArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the IAM role that the gateway assumes to create and manage infrastructure on your behalf.

  • clientToken (string) –

    A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request, but does not return an error.

    This field is autopopulated if not provided.

  • deletionProtection (boolean) – Specifies whether to enable deletion protection for the gateway. When enabled, the gateway can’t be deleted, and the gateway propagates this setting to the load balancers it manages. The default is true.

  • configuration (dict) –

    [REQUIRED]

    The type-specific configuration for the gateway. Exactly one configuration variant must be set, and it determines the gateway type. For example, hostSharedAlb configures a gateway that uses Application Load Balancers with host-based routing.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: hostSharedAlb.

    • hostSharedAlb (dict) –

      The configuration for a host-based, shared Application Load Balancer gateway. Each service that uses the gateway is assigned a unique DNS host name.

      • networkConfiguration (dict) –

        The network configuration for the load balancers that the gateway manages.

        • inboundSecurityGroup (string) –

          The ID of a security group that you provide to control inbound traffic to the load balancers that the gateway manages. When you specify a security group, the gateway doesn’t create inbound rules on the security group it manages.

        • subnets (list) –

          The subnets for the load balancers that the gateway manages. The default is the subnets in the default VPC.

          • (string) –

        • ipAddressType (string) –

          The IP address type for the load balancers that the gateway manages. The default is dualstack.

      • scheme (string) –

        Specifies whether the load balancers the gateway manages are internet-facing or internal. The default is internet-facing.

      • webACLArn (string) –

        The Amazon Resource Name (ARN) of the WAF web ACL to associate with the load balancers that the gateway manages.

      • accessLogs (dict) –

        The access log configuration for the load balancers that the gateway manages.

        • destination (dict) –

          The destination where access logs are delivered.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: s3.

          • s3 (dict) –

            The Amazon S3 destination for access logs.

            • bucket (string) – [REQUIRED]

              The name of the Amazon S3 bucket where access logs are delivered.

            • prefix (string) –

              The object key prefix for the access logs in the Amazon S3 bucket.

      • port (integer) –

        The port that the load balancer listener uses is 443. The gateway supports only HTTPS at port 443.

      • protocol (string) –

        The protocol for the load balancer listener is HTTPS. No other protocol is supported.

      • maxAlbCount (integer) –

        The maximum number of Application Load Balancers that the gateway manages. The default is 10.

      • httpDesync (string) –

        The desync mitigation mode for the load balancers that the gateway manages, which determines how the load balancers handle requests that might pose a security risk. The default is defensive.

      • testTrafficRules (dict) –

        The rules that route test traffic for progressive deployments. During a progressive deployment, requests whose headers match these rules are routed to the new service revision so that it can be validated before production traffic shifts to it.

        • header (dict) –

          The header-based rule that identifies test traffic.

          • name (string) – [REQUIRED]

            The name of the header to match for test traffic routing.

          • values (list) – [REQUIRED]

            The header values to match for test traffic routing.

            • (string) –

  • tags (list) –

    The metadata that you apply to the gateway to help you categorize and organize it. Each tag consists of a key and an optional value. Depending on propagateTags, these tags can be applied to the infrastructure the gateway manages.

    • (dict) –

      The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value. You define them.

      The following basic restrictions apply to tags:

      • Maximum number of tags per resource - 50

      • For each resource, each tag key must be unique, and each tag key can have only one value.

      • Maximum key length - 128 Unicode characters in UTF-8

      • Maximum value length - 256 Unicode characters in UTF-8

      • If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.

      • Tag keys and values are case-sensitive.

      • Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.

      • key (string) –

        One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

      • value (string) –

        The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

  • propagateTags (string) – Specifies whether to propagate the tags from the gateway to the infrastructure that the gateway manages. The default is GATEWAY.

Return type:

dict

Returns:

Response Syntax

{
    'gatewayArn': 'string',
    'name': 'string',
    'status': 'ACTIVE'|'UPDATE_IN_PROGRESS'|'UPDATE_COMPLETE'|'UPDATE_FAILED'|'DELETED'
}

Response Structure

  • (dict) –

    • gatewayArn (string) –

      The Amazon Resource Name (ARN) of the gateway.

    • name (string) –

      The name of the gateway.

    • status (string) –

      The status of the gateway. A newly created gateway is always ACTIVE.

Exceptions

  • ECS.Client.exceptions.AccessDeniedException

  • ECS.Client.exceptions.ServerException

  • ECS.Client.exceptions.InvalidParameterException

  • ECS.Client.exceptions.ClientException

  • ECS.Client.exceptions.UnsupportedFeatureException