ECS / Client / update_express_gateway_service

update_express_gateway_service

ECS.Client.update_express_gateway_service(**kwargs)

Updates an existing Express service configuration. Modifies container settings, resource allocation, auto-scaling configuration, and other service parameters without recreating the service.

Amazon ECS creates a new service revision with updated configuration and performs a rolling deployment to replace existing tasks. The service remains available during updates, ensuring zero-downtime deployments.

Some parameters like the infrastructure role cannot be modified after service creation and require creating a new service.

See also: AWS API Documentation

Request Syntax

response = client.update_express_gateway_service(
    serviceArn='string',
    executionRoleArn='string',
    healthCheckPath='string',
    primaryContainer={
        'image': 'string',
        'containerPort': 123,
        'awsLogsConfiguration': {
            'logGroup': 'string',
            'logStreamPrefix': 'string'
        },
        'repositoryCredentials': {
            'credentialsParameter': 'string'
        },
        'command': [
            'string',
        ],
        'environment': [
            {
                'name': 'string',
                'value': 'string'
            },
        ],
        'secrets': [
            {
                'name': 'string',
                'valueFrom': 'string'
            },
        ]
    },
    taskRoleArn='string',
    networkConfiguration={
        'securityGroups': [
            'string',
        ],
        'subnets': [
            'string',
        ]
    },
    cpu='string',
    memory='string',
    scalingTarget={
        'minTaskCount': 123,
        'maxTaskCount': 123,
        'autoScalingMetric': 'AVERAGE_CPU'|'AVERAGE_MEMORY'|'REQUEST_COUNT_PER_TARGET',
        'autoScalingTargetValue': 123
    }
)
Parameters:
  • serviceArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the Express service to update.

  • executionRoleArn (string) – The Amazon Resource Name (ARN) of the task execution role for the Express service.

  • healthCheckPath (string) – The path on the container for Application Load Balancer health checks.

  • primaryContainer (dict) –

    The primary container configuration for the Express service.

    • image (string) – [REQUIRED]

      The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest.

      For Express services, the image typically contains a web application that listens on the specified container port. The image can be stored in Amazon ECR, Docker Hub, or any other container registry accessible to your execution role.

    • containerPort (integer) –

      The port number on the container that receives traffic from the load balancer. Default is 80.

    • awsLogsConfiguration (dict) –

      The log configuration for the container.

      • logGroup (string) – [REQUIRED]

        The name of the CloudWatch Logs log group to send container logs to.

      • logStreamPrefix (string) – [REQUIRED]

        The prefix for the CloudWatch Logs log stream names. The default for an Express service is ecs.

    • repositoryCredentials (dict) –

      The configuration for repository credentials for private registry authentication.

      • credentialsParameter (string) –

        The Amazon Resource Name (ARN) of the secret containing the private repository credentials.

    • command (list) –

      The command that is passed to the container.

      • (string) –

    • environment (list) –

      The environment variables to pass to the container.

      • (dict) –

        A key-value pair object.

        • name (string) –

          The name of the key-value pair. For environment variables, this is the name of the environment variable.

        • value (string) –

          The value of the key-value pair. For environment variables, this is the value of the environment variable.

    • secrets (list) –

      The secrets to pass to the container.

      • (dict) –

        An object representing the secret to expose to your container. Secrets can be exposed to a container in the following ways:

        • To inject sensitive data into your containers as environment variables, use the secrets container definition parameter.

        • To reference sensitive information in the log configuration of a container, use the secretOptions container definition parameter.

        For more information, see Specifying sensitive data in the Amazon Elastic Container Service Developer Guide.

        • name (string) – [REQUIRED]

          The name of the secret.

        • valueFrom (string) – [REQUIRED]

          The secret to expose to the container. The supported values are either the full ARN of the Secrets Manager secret or the full ARN of the parameter in the SSM Parameter Store.

          For information about the require Identity and Access Management permissions, see Required IAM permissions for Amazon ECS secrets (for Secrets Manager) or Required IAM permissions for Amazon ECS secrets (for Systems Manager Parameter store) in the Amazon Elastic Container Service Developer Guide.

          Note

          If the SSM Parameter Store parameter exists in the same Region as the task you’re launching, then you can use either the full ARN or name of the parameter. If the parameter exists in a different Region, then the full ARN must be specified.

  • taskRoleArn (string) – The Amazon Resource Name (ARN) of the IAM role for containers in this task.

  • networkConfiguration (dict) –

    The network configuration for the Express service tasks. By default, the network configuration for an Express service uses the default VPC.

    • securityGroups (list) –

      The IDs of the security groups associated with the Express service.

      • (string) –

    • subnets (list) –

      The IDs of the subnets associated with the Express service.

      • (string) –

  • cpu (string) – The number of CPU units used by the task.

  • memory (string) – The amount of memory (in MiB) used by the task.

  • scalingTarget (dict) –

    The auto-scaling configuration for the Express service.

    • minTaskCount (integer) –

      The minimum number of tasks to run in the Express service.

    • maxTaskCount (integer) –

      The maximum number of tasks to run in the Express service.

    • autoScalingMetric (string) –

      The metric used for auto-scaling decisions. The default metric used for an Express service is CPUUtilization.

    • autoScalingTargetValue (integer) –

      The target value for the auto-scaling metric. The default value for an Express service is 60.

Return type:

dict

Returns:

Response Syntax

{
    'service': {
        'serviceArn': 'string',
        'cluster': 'string',
        'serviceName': 'string',
        'status': {
            'statusCode': 'ACTIVE'|'DRAINING'|'INACTIVE',
            'statusReason': 'string'
        },
        'targetConfiguration': {
            'serviceRevisionArn': 'string',
            'executionRoleArn': 'string',
            'taskRoleArn': 'string',
            'cpu': 'string',
            'memory': 'string',
            'networkConfiguration': {
                'securityGroups': [
                    'string',
                ],
                'subnets': [
                    'string',
                ]
            },
            'healthCheckPath': 'string',
            'primaryContainer': {
                'image': 'string',
                'containerPort': 123,
                'awsLogsConfiguration': {
                    'logGroup': 'string',
                    'logStreamPrefix': 'string'
                },
                'repositoryCredentials': {
                    'credentialsParameter': 'string'
                },
                'command': [
                    'string',
                ],
                'environment': [
                    {
                        'name': 'string',
                        'value': 'string'
                    },
                ],
                'secrets': [
                    {
                        'name': 'string',
                        'valueFrom': 'string'
                    },
                ]
            },
            'scalingTarget': {
                'minTaskCount': 123,
                'maxTaskCount': 123,
                'autoScalingMetric': 'AVERAGE_CPU'|'AVERAGE_MEMORY'|'REQUEST_COUNT_PER_TARGET',
                'autoScalingTargetValue': 123
            },
            'ingressPaths': [
                {
                    'accessType': 'PUBLIC'|'PRIVATE',
                    'endpoint': 'string'
                },
            ],
            'createdAt': datetime(2015, 1, 1)
        },
        'createdAt': datetime(2015, 1, 1),
        'updatedAt': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) –

    • service (dict) –

      The full description of your express gateway service following the update call.

      • serviceArn (string) –

        The ARN of the Express service that is being updated.

      • cluster (string) –

        The cluster associated with the Express service that is being updated.

      • serviceName (string) –

        The name of the Express service that is being updated.

      • status (dict) –

        The status of the Express service that is being updated.

        • statusCode (string) –

          The status of the Express service.

        • statusReason (string) –

          Information about why the Express service is in the current status.

      • targetConfiguration (dict) –

        The configuration to which the current Express service is being updated to.

        • serviceRevisionArn (string) –

          The ARN of the service revision.

        • executionRoleArn (string) –

          The ARN of the task execution role for the service revision.

        • taskRoleArn (string) –

          The ARN of the task role for the service revision.

        • cpu (string) –

          The CPU allocation for tasks in this service revision.

        • memory (string) –

          The memory allocation for tasks in this service revision.

        • networkConfiguration (dict) –

          The network configuration for tasks in this service revision.

          • securityGroups (list) –

            The IDs of the security groups associated with the Express service.

            • (string) –

          • subnets (list) –

            The IDs of the subnets associated with the Express service.

            • (string) –

        • healthCheckPath (string) –

          The health check path for this service revision.

        • primaryContainer (dict) –

          The primary container configuration for this service revision.

          • image (string) –

            The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest.

            For Express services, the image typically contains a web application that listens on the specified container port. The image can be stored in Amazon ECR, Docker Hub, or any other container registry accessible to your execution role.

          • containerPort (integer) –

            The port number on the container that receives traffic from the load balancer. Default is 80.

          • awsLogsConfiguration (dict) –

            The log configuration for the container.

            • logGroup (string) –

              The name of the CloudWatch Logs log group to send container logs to.

            • logStreamPrefix (string) –

              The prefix for the CloudWatch Logs log stream names. The default for an Express service is ecs.

          • repositoryCredentials (dict) –

            The configuration for repository credentials for private registry authentication.

            • credentialsParameter (string) –

              The Amazon Resource Name (ARN) of the secret containing the private repository credentials.

          • command (list) –

            The command that is passed to the container.

            • (string) –

          • environment (list) –

            The environment variables to pass to the container.

            • (dict) –

              A key-value pair object.

              • name (string) –

                The name of the key-value pair. For environment variables, this is the name of the environment variable.

              • value (string) –

                The value of the key-value pair. For environment variables, this is the value of the environment variable.

          • secrets (list) –

            The secrets to pass to the container.

            • (dict) –

              An object representing the secret to expose to your container. Secrets can be exposed to a container in the following ways:

              • To inject sensitive data into your containers as environment variables, use the secrets container definition parameter.

              • To reference sensitive information in the log configuration of a container, use the secretOptions container definition parameter.

              For more information, see Specifying sensitive data in the Amazon Elastic Container Service Developer Guide.

              • name (string) –

                The name of the secret.

              • valueFrom (string) –

                The secret to expose to the container. The supported values are either the full ARN of the Secrets Manager secret or the full ARN of the parameter in the SSM Parameter Store.

                For information about the require Identity and Access Management permissions, see Required IAM permissions for Amazon ECS secrets (for Secrets Manager) or Required IAM permissions for Amazon ECS secrets (for Systems Manager Parameter store) in the Amazon Elastic Container Service Developer Guide.

                Note

                If the SSM Parameter Store parameter exists in the same Region as the task you’re launching, then you can use either the full ARN or name of the parameter. If the parameter exists in a different Region, then the full ARN must be specified.

        • scalingTarget (dict) –

          The auto-scaling configuration for this service revision.

          • minTaskCount (integer) –

            The minimum number of tasks to run in the Express service.

          • maxTaskCount (integer) –

            The maximum number of tasks to run in the Express service.

          • autoScalingMetric (string) –

            The metric used for auto-scaling decisions. The default metric used for an Express service is CPUUtilization.

          • autoScalingTargetValue (integer) –

            The target value for the auto-scaling metric. The default value for an Express service is 60.

        • ingressPaths (list) –

          The entry point into this service revision.

          • (dict) –

            The entry point into an Express service.

            • accessType (string) –

              The type of access to the endpoint for the Express service.

            • endpoint (string) –

              The endpoint for access to the service.

        • createdAt (datetime) –

          The Unix timestamp for when this service revision was created.

      • createdAt (datetime) –

        The Unix timestamp for when the Express service that is being updated was created.

      • updatedAt (datetime) –

        The Unix timestamp for when the Express service that is being updated was most recently updated.

Exceptions

  • ECS.Client.exceptions.AccessDeniedException

  • ECS.Client.exceptions.ClientException

  • ECS.Client.exceptions.ClusterNotFoundException

  • ECS.Client.exceptions.InvalidParameterException

  • ECS.Client.exceptions.ServerException

  • ECS.Client.exceptions.ServiceNotFoundException

  • ECS.Client.exceptions.ServiceNotActiveException

  • ECS.Client.exceptions.UnsupportedFeatureException