Skip to content

update_service

update_service(
    service_arn: AppRunnerResourceArn,
    *,
    config_overrides: Optional[AppRunnerClientConfig] = None,
    source_configuration: Optional[SourceConfiguration] = None,
    instance_configuration: Optional[InstanceConfiguration] = None,
    auto_scaling_configuration_arn: Optional[AppRunnerResourceArn] = None,
    health_check_configuration: Optional[HealthCheckConfiguration] = None,
    network_configuration: Optional[NetworkConfiguration] = None,
    observability_configuration: Optional[ServiceObservabilityConfiguration] = None,
) -> UpdateServiceResponse

Update an App Runner service. You can update the source configuration and instance configuration of the service. You can also update the ARN of the auto scaling configuration resource that's associated with the service. However, you can't change the name or the encryption configuration of the service. These can be set only when you create the service.

To update the tags applied to your service, use the separate actions TagResource and UntagResource.

This is an asynchronous operation. On a successful call, you can use the returned OperationId and the ListOperations call to track the operation's progress.

Parameters:

  • service_arn (AppRunnerResourceArn) –

    The Amazon Resource Name (ARN) of the App Runner service that you want to update.

  • source_configuration (Optional[SourceConfiguration], default: None ) –

    The source configuration to apply to the App Runner service.

    You can change the configuration of the code or image repository that the service uses. However, you can't switch from code to image or the other way around. This means that you must provide the same structure member of SourceConfiguration that you originally included when you created the service. Specifically, you can include either CodeRepository or ImageRepository. To update the source configuration, set the values to members of the structure that you include.

  • instance_configuration (Optional[InstanceConfiguration], default: None ) –

    The runtime configuration to apply to instances (scaling units) of your service.

  • auto_scaling_configuration_arn (Optional[AppRunnerResourceArn], default: None ) –

    The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to associate with the App Runner service.

  • health_check_configuration (Optional[HealthCheckConfiguration], default: None ) –

    The settings for the health check that App Runner performs to monitor the health of the App Runner service.

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

    Configuration settings related to network traffic of the web application that the App Runner service runs.

  • observability_configuration (Optional[ServiceObservabilityConfiguration], default: None ) –

    The observability configuration of your service.

Raises:

Source code in docs_src/capo_apprunner/_services/app_runner.py
def update_service(
    self,
    service_arn: "capo_apprunner.types.app_runner_resource_arn.AppRunnerResourceArn",
    *,
    config_overrides: Optional[AppRunnerClientConfig] = None,
    source_configuration: Optional[
        "capo_apprunner.types.source_configuration.SourceConfiguration"
    ] = None,
    instance_configuration: Optional[
        "capo_apprunner.types.instance_configuration.InstanceConfiguration"
    ] = None,
    auto_scaling_configuration_arn: Optional[
        "capo_apprunner.types.app_runner_resource_arn.AppRunnerResourceArn"
    ] = None,
    health_check_configuration: Optional[
        "capo_apprunner.types.health_check_configuration.HealthCheckConfiguration"
    ] = None,
    network_configuration: Optional[
        "capo_apprunner.types.network_configuration.NetworkConfiguration"
    ] = None,
    observability_configuration: Optional[
        "capo_apprunner.types.service_observability_configuration.ServiceObservabilityConfiguration"
    ] = None,
) -> "capo_apprunner.types.update_service_response.UpdateServiceResponse":
    """<p>Update an App Runner service. You can update the source configuration and instance configuration of the service. You can also update the ARN of the auto scaling configuration resource that's associated with the service. However, you can't change the name or the encryption configuration of the service. These can be set only when you create the service.</p> <p>To update the tags applied to your service, use the separate actions <a>TagResource</a> and <a>UntagResource</a>.</p> <p>This is an asynchronous operation. On a successful call, you can use the returned <code>OperationId</code> and the <a>ListOperations</a> call to track the operation's progress.</p>

    Args:
        service_arn: <p>The Amazon Resource Name (ARN) of the App Runner service that you want to update.</p>
        source_configuration: <p>The source configuration to apply to the App Runner service.</p> <p>You can change the configuration of the code or image repository that the service uses. However, you can't switch from code to image or the other way around. This means that you must provide the same structure member of <code>SourceConfiguration</code> that you originally included when you created the service. Specifically, you can include either <code>CodeRepository</code> or <code>ImageRepository</code>. To update the source configuration, set the values to members of the structure that you include.</p>
        instance_configuration: <p>The runtime configuration to apply to instances (scaling units) of your service.</p>
        auto_scaling_configuration_arn: <p>The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to associate with the App Runner service.</p>
        health_check_configuration: <p>The settings for the health check that App Runner performs to monitor the health of the App Runner service.</p>
        network_configuration: <p>Configuration settings related to network traffic of the web application that the App Runner service runs.</p>
        observability_configuration: <p>The observability configuration of your service.</p>

    Raises:
        capo_apprunner.errors.internal_service_error_exception.InternalServiceErrorException: <p>An unexpected service exception occurred.</p>
        capo_apprunner.errors.invalid_request_exception.InvalidRequestException: <p>One or more input parameters aren't valid. Refer to the API action's document page, correct the input parameters, and try the action again.</p>
        capo_apprunner.errors.invalid_state_exception.InvalidStateException: <p>You can't perform this action when the resource is in its current state.</p>
        capo_apprunner.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource doesn't exist for the specified Amazon Resource Name (ARN) in your Amazon Web Services account.</p>
        capo_apprunner.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_apprunner.types.update_service_request.UpdateServiceRequest]",
    ) -> OperationResponse[
        "capo_apprunner.types.update_service_response.UpdateServiceResponse"
    ]:
        import capo_apprunner._operations.app_runner.update_service

        output, http_response = (
            capo_apprunner._operations.app_runner.update_service.update_service(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_apprunner.types.update_service_request.UpdateServiceRequest",
    ) -> dict[str, Any]:
        import capo_apprunner.types.update_service_request

        return capo_apprunner.types.update_service_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_apprunner.types.update_service_response.UpdateServiceResponse",
    ) -> dict[str, Any]:
        import capo_apprunner.types.update_service_response

        return capo_apprunner.types.update_service_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateService",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_apprunner.types.update_service_request.UpdateServiceRequest = {
        "service_arn": service_arn
    }
    if source_configuration is not None:
        input_["source_configuration"] = source_configuration
    if instance_configuration is not None:
        input_["instance_configuration"] = instance_configuration
    if auto_scaling_configuration_arn is not None:
        input_["auto_scaling_configuration_arn"] = auto_scaling_configuration_arn
    if health_check_configuration is not None:
        input_["health_check_configuration"] = health_check_configuration
    if network_configuration is not None:
        input_["network_configuration"] = network_configuration
    if observability_configuration is not None:
        input_["observability_configuration"] = observability_configuration

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output