Skip to content

update_user_pool_domain async

update_user_pool_domain(
    domain: DomainType,
    user_pool_id: UserPoolIdType,
    *,
    config_overrides: Optional[AsyncCognitoIdentityProviderClientConfig] = None,
    managed_login_version: Optional[WrappedIntegerType] = None,
    custom_domain_config: Optional[CustomDomainConfigType] = None,
    routing: Optional[RoutingType] = None,
) -> UpdateUserPoolDomainResponse

A user pool domain hosts managed login, an authorization server and web server for authentication in your application. This operation updates the branding version for user pool domains between 1 for hosted UI (classic) and 2 for managed login. It also updates the SSL certificate for user pool custom domains.

Changes to the domain branding version take up to one minute to take effect for a prefix domain and up to five minutes for a custom domain.

This operation doesn't change the name of your user pool domain. To change your domain, delete it with DeleteUserPoolDomain and create a new domain with CreateUserPoolDomain.

You can pass the ARN of a new Certificate Manager certificate in this request. Typically, ACM certificates automatically renew and you user pool can continue to use the same ARN. But if you generate a new certificate for your custom domain name, replace the original configuration with the new ARN in this request.

ACM certificates for custom domains must be in the US East (N. Virginia) Amazon Web Services Region. After you submit your request, Amazon Cognito requires up to 1 hour to distribute your new certificate to your custom domain.

For more information about adding a custom domain to your user pool, see Configuring a user pool domain.

Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Parameters:

  • domain (DomainType) –

    The name of the domain that you want to update. For custom domains, this is the fully-qualified domain name, for example auth.example.com. For prefix domains, this is the prefix alone, such as myprefix.

  • user_pool_id (UserPoolIdType) –

    The ID of the user pool that is associated with the domain you're updating.

  • managed_login_version (Optional[WrappedIntegerType], default: None ) –

    A version number that indicates the state of managed login for your domain. Version 1 is hosted UI (classic). Version 2 is the newer managed login with the branding editor. For more information, see Managed login.

  • custom_domain_config (Optional[CustomDomainConfigType], default: None ) –

    The configuration for a custom domain that hosts managed login for your application. In an UpdateUserPoolDomain request, this parameter specifies an SSL certificate for the managed login hosted webserver. The certificate must be an ACM ARN in us-east-1.

    When you create a custom domain, the passkey RP ID defaults to the custom domain. If you had a prefix domain active, this will cause passkey integration for your prefix domain to stop working due to a mismatch in RP ID. To keep the prefix domain passkey integration working, you can explicitly set RP ID to the prefix domain.

  • routing (Optional[RoutingType], default: None ) –

    The routing configuration for the user pool domain. Specifies failover settings for multi-region deployments.

Raises:

  • ConcurrentModificationException –

    This exception is thrown if two or more modifications are happening concurrently.

  • FeatureUnavailableInTierException –

    This exception is thrown when a feature that you attempted to use or configure isn't included in your user pool's current feature plan. This can occur when:

    • You configure a feature that your feature plan doesn't support.

    • You make a request that uses a feature that requires a higher feature plan.

    To resolve this issue, upgrade your user pool to a feature plan that includes the feature.

  • InternalErrorException –

    This exception is thrown when Amazon Cognito encounters an internal error.

  • InvalidParameterException –

    This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

  • NotAuthorizedException –

    This exception is thrown when a user isn't authorized.

  • OperationNotEnabledException –

    This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.

  • ResourceNotFoundException –

    This exception is thrown when the Amazon Cognito service can't find the requested resource.

  • TooManyRequestsException –

    This exception is thrown when the user has made too many requests for a given operation.

  • UnknownServiceError –

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

Source code in docs_src/capo_cognito_identity_provider/_services/async_cognito_identity_provider.py
async def update_user_pool_domain(
    self,
    domain: "capo_cognito_identity_provider.types.domain_type.DomainType",
    user_pool_id: "capo_cognito_identity_provider.types.user_pool_id_type.UserPoolIdType",
    *,
    config_overrides: Optional[AsyncCognitoIdentityProviderClientConfig] = None,
    managed_login_version: Optional[
        "capo_cognito_identity_provider.types.wrapped_integer_type.WrappedIntegerType"
    ] = None,
    custom_domain_config: Optional[
        "capo_cognito_identity_provider.types.custom_domain_config_type.CustomDomainConfigType"
    ] = None,
    routing: Optional[
        "capo_cognito_identity_provider.types.routing_type.RoutingType"
    ] = None,
) -> "capo_cognito_identity_provider.types.update_user_pool_domain_response.UpdateUserPoolDomainResponse":
    """<p>A user pool domain hosts managed login, an authorization server and web server for authentication in your application. This operation updates the branding version for user pool domains between <code>1</code> for hosted UI (classic) and <code>2</code> for managed login. It also updates the SSL certificate for user pool custom domains.</p> <p>Changes to the domain branding version take up to one minute to take effect for a prefix domain and up to five minutes for a custom domain.</p> <p>This operation doesn't change the name of your user pool domain. To change your domain, delete it with <code>DeleteUserPoolDomain</code> and create a new domain with <code>CreateUserPoolDomain</code>.</p> <p>You can pass the ARN of a new Certificate Manager certificate in this request. Typically, ACM certificates automatically renew and you user pool can continue to use the same ARN. But if you generate a new certificate for your custom domain name, replace the original configuration with the new ARN in this request.</p> <p>ACM certificates for custom domains must be in the US East (N. Virginia) Amazon Web Services Region. After you submit your request, Amazon Cognito requires up to 1 hour to distribute your new certificate to your custom domain.</p> <p>For more information about adding a custom domain to your user pool, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-add-custom-domain.html">Configuring a user pool domain</a>.</p> <note> <p>Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.</p> <p class="title"> <b>Learn more</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-signing.html">Signing Amazon Web Services API Requests</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pools-API-operations.html">Using the Amazon Cognito user pools API and user pool endpoints</a> </p> </li> </ul> </note>

    Args:
        domain: <p>The name of the domain that you want to update. For custom domains, this is the fully-qualified domain name, for example <code>auth.example.com</code>. For prefix domains, this is the prefix alone, such as <code>myprefix</code>.</p>
        user_pool_id: <p>The ID of the user pool that is associated with the domain you're updating.</p>
        managed_login_version: <p>A version number that indicates the state of managed login for your domain. Version <code>1</code> is hosted UI (classic). Version <code>2</code> is the newer managed login with the branding editor. For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-managed-login.html">Managed login</a>.</p>
        custom_domain_config: <p>The configuration for a custom domain that hosts managed login for your application. In an <code>UpdateUserPoolDomain</code> request, this parameter specifies an SSL certificate for the managed login hosted webserver. The certificate must be an ACM ARN in <code>us-east-1</code>.</p> <p>When you create a custom domain, the passkey RP ID defaults to the custom domain. If you had a prefix domain active, this will cause passkey integration for your prefix domain to stop working due to a mismatch in RP ID. To keep the prefix domain passkey integration working, you can explicitly set RP ID to the prefix domain.</p>
        routing: <p>The routing configuration for the user pool domain. Specifies failover settings for multi-region deployments.</p>

    Raises:
        capo_cognito_identity_provider.errors.concurrent_modification_exception.ConcurrentModificationException: <p>This exception is thrown if two or more modifications are happening concurrently.</p>
        capo_cognito_identity_provider.errors.feature_unavailable_in_tier_exception.FeatureUnavailableInTierException: <p>This exception is thrown when a feature that you attempted to use or configure isn't included in your user pool's current feature plan. This can occur when:</p> <ul> <li> <p>You configure a feature that your feature plan doesn't support.</p> </li> <li> <p>You make a request that uses a feature that requires a higher feature plan.</p> </li> </ul> <p>To resolve this issue, upgrade your user pool to a feature plan that includes the feature.</p>
        capo_cognito_identity_provider.errors.internal_error_exception.InternalErrorException: <p>This exception is thrown when Amazon Cognito encounters an internal error.</p>
        capo_cognito_identity_provider.errors.invalid_parameter_exception.InvalidParameterException: <p>This exception is thrown when the Amazon Cognito service encounters an invalid parameter.</p>
        capo_cognito_identity_provider.errors.not_authorized_exception.NotAuthorizedException: <p>This exception is thrown when a user isn't authorized.</p>
        capo_cognito_identity_provider.errors.operation_not_enabled_exception.OperationNotEnabledException: <p>This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.</p>
        capo_cognito_identity_provider.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when the Amazon Cognito service can't find the requested resource.</p>
        capo_cognito_identity_provider.errors.too_many_requests_exception.TooManyRequestsException: <p>This exception is thrown when the user has made too many requests for a given operation.</p>
        capo_cognito_identity_provider.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cognito_identity_provider.types.update_user_pool_domain_request.UpdateUserPoolDomainRequest]",
    ) -> AsyncOperationResponse[
        "capo_cognito_identity_provider.types.update_user_pool_domain_response.UpdateUserPoolDomainResponse"
    ]:
        import capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.update_user_pool_domain

        (
            output,
            http_response,
        ) = await capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.update_user_pool_domain.async_update_user_pool_domain(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateUserPoolDomain")
    )
    input_: capo_cognito_identity_provider.types.update_user_pool_domain_request.UpdateUserPoolDomainRequest = {
        "domain": domain,
        "user_pool_id": user_pool_id,
    }
    if managed_login_version is not None:
        input_["managed_login_version"] = managed_login_version
    if custom_domain_config is not None:
        input_["custom_domain_config"] = custom_domain_config
    if routing is not None:
        input_["routing"] = routing

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