Skip to content

create_auto_scaling_configuration async

create_auto_scaling_configuration(
    auto_scaling_configuration_name: AutoScalingConfigurationName,
    *,
    config_overrides: Optional[AsyncAppRunnerClientConfig] = None,
    max_concurrency: Optional[ASConfigMaxConcurrency] = None,
    min_size: Optional[ASConfigMinSize] = None,
    max_size: Optional[ASConfigMaxSize] = None,
    tags: Optional[TagList] = None,
) -> CreateAutoScalingConfigurationResponse

Create an App Runner automatic scaling configuration resource. App Runner requires this resource when you create or update App Runner services and you require non-default auto scaling settings. You can share an auto scaling configuration across multiple services.

Create multiple revisions of a configuration by calling this action multiple times using the same AutoScalingConfigurationName. The call returns incremental AutoScalingConfigurationRevision values. When you create a service and configure an auto scaling configuration resource, the service uses the latest active revision of the auto scaling configuration by default. You can optionally configure the service to use a specific revision.

Configure a higher MinSize to increase the spread of your App Runner service over more Availability Zones in the Amazon Web Services Region. The tradeoff is a higher minimal cost.

Configure a lower MaxSize to control your cost. The tradeoff is lower responsiveness during peak demand.

Parameters:

  • auto_scaling_configuration_name (AutoScalingConfigurationName) –

    A name for the auto scaling configuration. When you use it for the first time in an Amazon Web Services Region, App Runner creates revision number 1 of this name. When you use the same name in subsequent calls, App Runner creates incremental revisions of the configuration.

    Prior to the release of Auto scale configuration enhancements, the name DefaultConfiguration was reserved.

    This restriction is no longer in place. You can now manage DefaultConfiguration the same way you manage your custom auto scaling configurations. This means you can do the following with the DefaultConfiguration that App Runner provides:

    • Create new revisions of the DefaultConfiguration.

    • Delete the revisions of the DefaultConfiguration.

    • Delete the auto scaling configuration for which the App Runner DefaultConfiguration was created.

    • If you delete the auto scaling configuration you can create another custom auto scaling configuration with the same DefaultConfiguration name. The original DefaultConfiguration resource provided by App Runner remains in your account unless you make changes to it.

  • max_concurrency (Optional[ASConfigMaxConcurrency], default: None ) –

    The maximum number of concurrent requests that you want an instance to process. If the number of concurrent requests exceeds this limit, App Runner scales up your service.

    Default: 100

  • min_size (Optional[ASConfigMinSize], default: None ) –

    The minimum number of instances that App Runner provisions for your service. The service always has at least MinSize provisioned instances. Some of them actively serve traffic. The rest of them (provisioned and inactive instances) are a cost-effective compute capacity reserve and are ready to be quickly activated. You pay for memory usage of all the provisioned instances. You pay for CPU usage of only the active subset.

    App Runner temporarily doubles the number of provisioned instances during deployments, to maintain the same capacity for both old and new code.

    Default: 1

  • max_size (Optional[ASConfigMaxSize], default: None ) –

    The maximum number of instances that your service scales up to. At most MaxSize instances actively serve traffic for your service.

    Default: 25

  • tags (Optional[TagList], default: None ) –

    A list of metadata items that you can associate with your auto scaling configuration resource. A tag is a key-value pair.

Raises:

Source code in docs_src/capo_apprunner/_services/async_app_runner.py
async def create_auto_scaling_configuration(
    self,
    auto_scaling_configuration_name: "capo_apprunner.types.auto_scaling_configuration_name.AutoScalingConfigurationName",
    *,
    config_overrides: Optional[AsyncAppRunnerClientConfig] = None,
    max_concurrency: Optional[
        "capo_apprunner.types.as_config_max_concurrency.ASConfigMaxConcurrency"
    ] = None,
    min_size: Optional[
        "capo_apprunner.types.as_config_min_size.ASConfigMinSize"
    ] = None,
    max_size: Optional[
        "capo_apprunner.types.as_config_max_size.ASConfigMaxSize"
    ] = None,
    tags: Optional["capo_apprunner.types.tag_list.TagList"] = None,
) -> "capo_apprunner.types.create_auto_scaling_configuration_response.CreateAutoScalingConfigurationResponse":
    """<p>Create an App Runner automatic scaling configuration resource. App Runner requires this resource when you create or update App Runner services and you require non-default auto scaling settings. You can share an auto scaling configuration across multiple services.</p> <p>Create multiple revisions of a configuration by calling this action multiple times using the same <code>AutoScalingConfigurationName</code>. The call returns incremental <code>AutoScalingConfigurationRevision</code> values. When you create a service and configure an auto scaling configuration resource, the service uses the latest active revision of the auto scaling configuration by default. You can optionally configure the service to use a specific revision.</p> <p>Configure a higher <code>MinSize</code> to increase the spread of your App Runner service over more Availability Zones in the Amazon Web Services Region. The tradeoff is a higher minimal cost.</p> <p>Configure a lower <code>MaxSize</code> to control your cost. The tradeoff is lower responsiveness during peak demand.</p>

    Args:
        auto_scaling_configuration_name: <p>A name for the auto scaling configuration. When you use it for the first time in an Amazon Web Services Region, App Runner creates revision number <code>1</code> of this name. When you use the same name in subsequent calls, App Runner creates incremental revisions of the configuration.</p> <note> <p>Prior to the release of <a href="https://docs.aws.amazon.com/apprunner/latest/relnotes/release-2023-09-22-auto-scale-config.html">Auto scale configuration enhancements</a>, the name <code>DefaultConfiguration</code> was reserved. </p> <p>This restriction is no longer in place. You can now manage <code>DefaultConfiguration</code> the same way you manage your custom auto scaling configurations. This means you can do the following with the <code>DefaultConfiguration</code> that App Runner provides:</p> <ul> <li> <p>Create new revisions of the <code>DefaultConfiguration</code>.</p> </li> <li> <p>Delete the revisions of the <code>DefaultConfiguration</code>.</p> </li> <li> <p>Delete the auto scaling configuration for which the App Runner <code>DefaultConfiguration</code> was created.</p> </li> <li> <p>If you delete the auto scaling configuration you can create another custom auto scaling configuration with the same <code>DefaultConfiguration</code> name. The original <code>DefaultConfiguration</code> resource provided by App Runner remains in your account unless you make changes to it.</p> </li> </ul> </note>
        max_concurrency: <p>The maximum number of concurrent requests that you want an instance to process. If the number of concurrent requests exceeds this limit, App Runner scales up your service.</p> <p>Default: <code>100</code> </p>
        min_size: <p>The minimum number of instances that App Runner provisions for your service. The service always has at least <code>MinSize</code> provisioned instances. Some of them actively serve traffic. The rest of them (provisioned and inactive instances) are a cost-effective compute capacity reserve and are ready to be quickly activated. You pay for memory usage of all the provisioned instances. You pay for CPU usage of only the active subset.</p> <p>App Runner temporarily doubles the number of provisioned instances during deployments, to maintain the same capacity for both old and new code.</p> <p>Default: <code>1</code> </p>
        max_size: <p>The maximum number of instances that your service scales up to. At most <code>MaxSize</code> instances actively serve traffic for your service.</p> <p>Default: <code>25</code> </p>
        tags: <p>A list of metadata items that you can associate with your auto scaling configuration resource. A tag is a key-value pair.</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.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>App Runner can't create this resource. You've reached your account quota for this resource type.</p> <p>For App Runner per-resource quotas, see <a href="https://docs.aws.amazon.com/general/latest/gr/apprunner.html">App Runner endpoints and quotas</a> in the <i>Amazon Web Services General Reference</i>.</p>
        capo_apprunner.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_apprunner.types.create_auto_scaling_configuration_request.CreateAutoScalingConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_apprunner.types.create_auto_scaling_configuration_response.CreateAutoScalingConfigurationResponse"
    ]:
        import capo_apprunner._operations.app_runner.create_auto_scaling_configuration

        (
            output,
            http_response,
        ) = await capo_apprunner._operations.app_runner.create_auto_scaling_configuration.async_create_auto_scaling_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAutoScalingConfiguration")
    )
    input_: capo_apprunner.types.create_auto_scaling_configuration_request.CreateAutoScalingConfigurationRequest = {
        "auto_scaling_configuration_name": auto_scaling_configuration_name
    }
    if max_concurrency is not None:
        input_["max_concurrency"] = max_concurrency
    if min_size is not None:
        input_["min_size"] = min_size
    if max_size is not None:
        input_["max_size"] = max_size
    if tags is not None:
        input_["tags"] = tags

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