AWS::Cognito::UserPoolDomain
The AWS::Cognito::UserPoolDomain resource creates a new domain for a user pool.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::Cognito::UserPoolDomain", "Properties" : { "CustomDomainConfig" :CustomDomainConfigType, "Domain" :String, "UserPoolId" :String} }
YAML
Type: AWS::Cognito::UserPoolDomain Properties: CustomDomainConfig:CustomDomainConfigTypeDomain:StringUserPoolId:String
Properties
CustomDomainConfig-
The configuration for a custom domain that hosts the sign-up and sign-in pages for your application. Use this object to specify an SSL certificate that is managed by ACM.
Required: No
Type: CustomDomainConfigType
Update requires: No interruption
Domain-
The domain name for the domain that hosts the sign-up and sign-in pages for your application. For example:
auth.example.com. If you're using a prefix domain, this field denotes the first part of the domain before.auth.[region].amazoncognito.com.This string can include only lowercase letters, numbers, and hyphens. Don't use a hyphen for the first or last character. Use periods to separate subdomain names.
Required: Yes
Type: String
Minimum:
1Maximum:
63Pattern:
^[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?$Update requires: Replacement
UserPoolId-
The user pool ID for the user pool where you want to associate a user pool domain.
Required: Yes
Type: String
Minimum:
1Maximum:
55Pattern:
[\w-]+_[0-9a-zA-Z]+Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Reffunction, Refreturns physicalResourceId, which is “Domain". For example:
{ "Ref": "your-test-domain" }
For the Amazon Cognito user pool domain your-test-domain, Ref returns the
name of the user pool domain.
For more information about using the Reffunction, see Ref.
Fn::GetAtt
The Fn::GetAttintrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAttintrinsic function, see Fn::GetAtt.
Examples
Creating a new custom domain for a user pool
The following example creates a custom domain, "my-test-user-pool-domain", in the referenced user pool.
JSON
{ "UserPoolDomain":{ "Type":"AWS::Cognito::UserPoolDomain", "Properties":{ "UserPoolId":{ "Ref":"UserPool" }, "Domain":"my-test-user-pool-domain.myapplication.com", "CustomDomainConfig":{ "CertificateArn":{ "Ref":"CertificateArn" } } } } }
YAML
UserPoolDomain: Type: AWS::Cognito::UserPoolDomain Properties: UserPoolId: !Ref UserPool Domain: "my-test-user-pool-domain.myapplication.com" CustomDomainConfig: CertificateArn: !Ref CertificateArn
Creating a new default domain for a user pool
The following example creates a new default domain, "my-test-user-pool-domain", in the referenced user pool.
JSON
{ "UserPoolDomain":{ "Type":"AWS::Cognito::UserPoolDomain", "Properties":{ "UserPoolId":{ "Ref":"UserPool" }, "Domain":"my-test-user-pool-domain" } } }
YAML
UserPoolDomain: Type: AWS::Cognito::UserPoolDomain Properties: UserPoolId: !Ref UserPool Domain: "my-test-user-pool-domain"