AWS Amazon Cognito User Pool Domain
This page shows how to write Terraform and CloudFormation for Amazon Cognito User Pool Domain and write them securely.
aws_cognito_user_pool_domain (Terraform)
The User Pool Domain in Amazon Cognito can be configured in Terraform with the resource name aws_cognito_user_pool_domain
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_cognito_user_pool_domain" "this" {
domain = var.service_domain
user_pool_id = aws_cognito_user_pool.this.id
}
resource "aws_cognito_user_pool_domain" "default" {
domain = var.domain
user_pool_id = aws_cognito_user_pool.default.id
certificate_arn = var.certificate_arn
}
resource "aws_cognito_user_pool_domain" "main" {
domain = "homelike"
user_pool_id = aws_cognito_user_pool.pool.id
}
resource "aws_cognito_user_pool_client" "client" {
resource "aws_cognito_user_pool_domain" "main" {
domain = var.domain
user_pool_id = var.user_pool_id
Parameters
-
aws_account_id
optional computed - string -
certificate_arn
optional - string -
cloudfront_distribution_arn
optional computed - string -
domain
required - string -
id
optional computed - string -
s3_bucket
optional computed - string -
user_pool_id
required - string -
version
optional computed - string
Explanation in Terraform Registry
Provides a Cognito User Pool Domain resource.
AWS::Cognito::UserPoolDomain (CloudFormation)
The UserPoolDomain in Cognito can be configured in CloudFormation with the resource name AWS::Cognito::UserPoolDomain
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::Cognito::UserPoolDomain
Properties:
Domain: ${self:service}-${self:custom.stage}
UserPoolId: !Ref UserPool
Type: AWS::Cognito::UserPoolDomain
Properties:
Domain: mimooauth
UserPoolId: !Ref CognitoUserPool
Type: AWS::Cognito::UserPoolDomain
Condition: IsPro
DependsOn: WebsiteDNSName
Properties:
CustomDomainConfig:
CertificateArn: ${self:custom.certificateArn}
Type: AWS::Cognito::UserPoolDomain
Properties:
UserPoolId:
Ref: CognitoUserPool
Type: AWS::Cognito::UserPoolDomain
Properties:
Domain: ${self:provider.stage}-${self:service}
UserPoolId:
"Type": "AWS::Cognito::UserPoolDomain",
"Properties": {
"Domain": "alexa-time-bot",
"UserPoolId": {
"Ref": "timeBotUserPool"
}
"Type" : "AWS::Cognito::UserPoolDomain",
"Properties" : {
"Domain" : "expressboilerplateclientpool",
"UserPoolId" : {
"Ref": "expressboilerplatecognito"
}
"AWS::Cognito::UserPoolDomain.CustomDomainConfigType": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpooldomain-customdomainconfigtype.html",
"Properties": {
"CertificateArn": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpooldomain-customdomainconfigtype.html#cfn-cognito-userpooldomain-customdomainconfigtype-certificatearn",
"Type" : "AWS::Cognito::UserPoolDomain",
"Properties" : {
"Domain" : {"Ref": "DomainName"},
"UserPoolId" : {"Ref": "UserPoolId"}
}
}
"Type": "AWS::Cognito::UserPoolDomain",
"Properties": {
"UserPoolId": {
"Ref": "serviceUserPool"
},
"Domain": "space-user-pool-domain-dev-space-auth"
Parameters
-
UserPoolId
required - String -
CustomDomainConfig
optional - CustomDomainConfigType -
Domain
required - String
Explanation in CloudFormation Registry
The AWS::Cognito::UserPoolDomain resource creates a new domain for a user pool.
Frequently asked questions
What is AWS Amazon Cognito User Pool Domain?
AWS Amazon Cognito User Pool Domain is a resource for Amazon Cognito of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Amazon Cognito User Pool Domain?
For Terraform, the VictorAparecidoRibeiro/terraform-aws, bayinfosys/aws-cognito and LaurentEsc/homelike source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the Ankcorn/serverless-fullstack-example-app, andre94cavalcante/MimooBackendChallenge and mperezi/miguelito-api source code examples are useful. See the CloudFormation Example section for further details.