Skip to content

update_express_gateway_service async

update_express_gateway_service(
    service_arn: String,
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    execution_role_arn: Optional[String] = None,
    health_check_path: Optional[String] = None,
    primary_container: Optional[ExpressGatewayContainer] = None,
    task_role_arn: Optional[String] = None,
    network_configuration: Optional[ExpressGatewayServiceNetworkConfiguration] = None,
    cpu: Optional[String] = None,
    memory: Optional[String] = None,
    cpu_architecture: Optional[ExpressCpuArchitecture] = None,
    scaling_target: Optional[ExpressGatewayScalingTarget] = None,
    task_definition_arn: Optional[String] = None,
) -> UpdateExpressGatewayServiceResponse

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.

Parameters:

  • service_arn (String) –

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

  • execution_role_arn (Optional[String], default: None ) –

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

  • health_check_path (Optional[String], default: None ) –

    The path on the container for Application Load Balancer health checks.

  • primary_container (Optional[ExpressGatewayContainer], default: None ) –

    The primary container configuration for the Express service.

  • task_role_arn (Optional[String], default: None ) –

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

  • network_configuration (Optional[ExpressGatewayServiceNetworkConfiguration], default: None ) –

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

  • cpu (Optional[String], default: None ) –

    The number of CPU units used by the task.

  • memory (Optional[String], default: None ) –

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

  • cpu_architecture (Optional[ExpressCpuArchitecture], default: None ) –

    The CPU architecture that the task runs on. If you don't specify a value, the service keeps its current architecture.

    Valid values:

    • X86_64 - The x86 64-bit architecture.

    • ARM64 - The 64-bit ARM architecture.

    Changing the architecture starts a new deployment that replaces the running tasks. Ensure that the container image you specify supports the architecture you choose. The operating system family for an Express service is always LINUX.

    You can't specify cpuArchitecture together with taskDefinitionArn.

  • scaling_target (Optional[ExpressGatewayScalingTarget], default: None ) –

    The auto-scaling configuration for the Express service.

  • task_definition_arn (Optional[String], default: None ) –

    The Amazon Resource Name (ARN) of a task definition to use to update the Express Gateway service. This allows you to manage your own task definition, giving you more control over the service configuration such as adding sidecar containers.

    The task definition must have a container named Main with a single TCP port mapping that includes a container port and port name. The task definition must also have FARGATE compatibility.

    If you provide a task definition ARN, you cannot also specify primaryContainer, executionRoleArn, taskRoleArn, cpu, memory, or cpuArchitecture.

Raises:

  • AccessDeniedException –

    You don't have authorization to perform the requested action.

  • ClientException –

    These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.

  • ClusterNotFoundException –

    The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.

  • InvalidParameterException –

    The specified parameter isn't valid. Review the available parameters for the API request.

    For more information about service event errors, see Amazon ECS service event messages.

  • ServerException –

    These errors are usually caused by a server issue.

  • ServiceNotActiveException –

    The specified service isn't active. You can't update a service that's inactive. If you have previously deleted a service, you can re-create it with CreateService.

  • ServiceNotFoundException –

    The specified service wasn't found. You can view your available services with ListServices. Amazon ECS services are cluster specific and Region specific.

  • UnsupportedFeatureException –

    The specified task isn't supported in this Region.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_ecs/_services/async_ecs.py
async def update_express_gateway_service(
    self,
    service_arn: "capo_ecs.types.string.String",
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    execution_role_arn: Optional["capo_ecs.types.string.String"] = None,
    health_check_path: Optional["capo_ecs.types.string.String"] = None,
    primary_container: Optional[
        "capo_ecs.types.express_gateway_container.ExpressGatewayContainer"
    ] = None,
    task_role_arn: Optional["capo_ecs.types.string.String"] = None,
    network_configuration: Optional[
        "capo_ecs.types.express_gateway_service_network_configuration.ExpressGatewayServiceNetworkConfiguration"
    ] = None,
    cpu: Optional["capo_ecs.types.string.String"] = None,
    memory: Optional["capo_ecs.types.string.String"] = None,
    cpu_architecture: Optional[
        "capo_ecs.types.express_cpu_architecture.ExpressCpuArchitecture"
    ] = None,
    scaling_target: Optional[
        "capo_ecs.types.express_gateway_scaling_target.ExpressGatewayScalingTarget"
    ] = None,
    task_definition_arn: Optional["capo_ecs.types.string.String"] = None,
) -> "capo_ecs.types.update_express_gateway_service_response.UpdateExpressGatewayServiceResponse":
    """<p>Updates an existing Express service configuration. Modifies container settings, resource allocation, auto-scaling configuration, and other service parameters without recreating the service.</p> <p>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.</p> <p>Some parameters like the infrastructure role cannot be modified after service creation and require creating a new service.</p>

    Args:
        service_arn: <p>The Amazon Resource Name (ARN) of the Express service to update.</p>
        execution_role_arn: <p>The Amazon Resource Name (ARN) of the task execution role for the Express service.</p>
        health_check_path: <p>The path on the container for Application Load Balancer health checks.</p>
        primary_container: <p>The primary container configuration for the Express service.</p>
        task_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role for containers in this task.</p>
        network_configuration: <p>The network configuration for the Express service tasks. By default, the network configuration for an Express service uses the default VPC.</p>
        cpu: <p>The number of CPU units used by the task.</p>
        memory: <p>The amount of memory (in MiB) used by the task.</p>
        cpu_architecture: <p>The CPU architecture that the task runs on. If you don't specify a value, the service keeps its current architecture.</p> <p>Valid values:</p> <ul> <li> <p> <code>X86_64</code> - The x86 64-bit architecture.</p> </li> <li> <p> <code>ARM64</code> - The 64-bit ARM architecture.</p> </li> </ul> <p>Changing the architecture starts a new deployment that replaces the running tasks. Ensure that the container image you specify supports the architecture you choose. The operating system family for an Express service is always <code>LINUX</code>.</p> <p>You can't specify <code>cpuArchitecture</code> together with <code>taskDefinitionArn</code>.</p>
        scaling_target: <p>The auto-scaling configuration for the Express service.</p>
        task_definition_arn: <p>The Amazon Resource Name (ARN) of a task definition to use to update the Express Gateway service. This allows you to manage your own task definition, giving you more control over the service configuration such as adding sidecar containers.</p> <p>The task definition must have a container named <code>Main</code> with a single TCP port mapping that includes a container port and port name. The task definition must also have <code>FARGATE</code> compatibility.</p> <p>If you provide a task definition ARN, you cannot also specify <code>primaryContainer</code>, <code>executionRoleArn</code>, <code>taskRoleArn</code>, <code>cpu</code>, <code>memory</code>, or <code>cpuArchitecture</code>.</p>

    Raises:
        capo_ecs.errors.access_denied_exception.AccessDeniedException: <p>You don't have authorization to perform the requested action.</p>
        capo_ecs.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.</p>
        capo_ecs.errors.cluster_not_found_exception.ClusterNotFoundException: <p>The specified cluster wasn't found. You can view your available clusters with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListClusters.html">ListClusters</a>. Amazon ECS clusters are Region specific.</p>
        capo_ecs.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter isn't valid. Review the available parameters for the API request.</p> <p>For more information about service event errors, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html">Amazon ECS service event messages</a>. </p>
        capo_ecs.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_ecs.errors.service_not_active_exception.ServiceNotActiveException: <p>The specified service isn't active. You can't update a service that's inactive. If you have previously deleted a service, you can re-create it with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html">CreateService</a>.</p>
        capo_ecs.errors.service_not_found_exception.ServiceNotFoundException: <p>The specified service wasn't found. You can view your available services with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListServices.html">ListServices</a>. Amazon ECS services are cluster specific and Region specific.</p>
        capo_ecs.errors.unsupported_feature_exception.UnsupportedFeatureException: <p>The specified task isn't supported in this Region.</p>
        capo_ecs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecs.types.update_express_gateway_service_request.UpdateExpressGatewayServiceRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecs.types.update_express_gateway_service_response.UpdateExpressGatewayServiceResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.update_express_gateway_service

        (
            output,
            http_response,
        ) = await capo_ecs._operations.amazon_ec2_container_service_v20141113.update_express_gateway_service.async_update_express_gateway_service(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_ecs.types.update_express_gateway_service_request.UpdateExpressGatewayServiceRequest",
    ) -> dict[str, Any]:
        import capo_ecs.types.update_express_gateway_service_request

        return (
            capo_ecs.types.update_express_gateway_service_request.redact_sensitive(
                input_
            )
        )

    def _redact_output(
        output: "capo_ecs.types.update_express_gateway_service_response.UpdateExpressGatewayServiceResponse",
    ) -> dict[str, Any]:
        import capo_ecs.types.update_express_gateway_service_response

        return (
            capo_ecs.types.update_express_gateway_service_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateExpressGatewayService",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_ecs.types.update_express_gateway_service_request.UpdateExpressGatewayServiceRequest = {
        "service_arn": service_arn
    }
    if execution_role_arn is not None:
        input_["execution_role_arn"] = execution_role_arn
    if health_check_path is not None:
        input_["health_check_path"] = health_check_path
    if primary_container is not None:
        input_["primary_container"] = primary_container
    if task_role_arn is not None:
        input_["task_role_arn"] = task_role_arn
    if network_configuration is not None:
        input_["network_configuration"] = network_configuration
    if cpu is not None:
        input_["cpu"] = cpu
    if memory is not None:
        input_["memory"] = memory
    if cpu_architecture is not None:
        input_["cpu_architecture"] = cpu_architecture
    if scaling_target is not None:
        input_["scaling_target"] = scaling_target
    if task_definition_arn is not None:
        input_["task_definition_arn"] = task_definition_arn

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output