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

cognito.tf#L18
resource "aws_cognito_user_pool_domain" "this" {
  domain       = var.service_domain
  user_pool_id = aws_cognito_user_pool.this.id
}
domain.tf#L1
resource "aws_cognito_user_pool_domain" "default" {
  domain          = var.domain
  user_pool_id    = aws_cognito_user_pool.default.id
  certificate_arn = var.certificate_arn
}
cognito.tf#L24
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" {
main%20(4).tf#L1
resource "aws_cognito_user_pool_domain" "main" {
  domain       = var.domain
  user_pool_id = var.user_pool_id

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

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

HostedUi.yml#L4
    Type: AWS::Cognito::UserPoolDomain
    Properties:
      Domain: ${self:service}-${self:custom.stage}
      UserPoolId: !Ref UserPool
MimooUserPoolDomainFile.yml#L2
  Type: AWS::Cognito::UserPoolDomain
  Properties:
    Domain: mimooauth
    UserPoolId: !Ref CognitoUserPool
dns.resources.yml#L16
    Type: AWS::Cognito::UserPoolDomain
    Condition: IsPro
    DependsOn: WebsiteDNSName
    Properties:
      CustomDomainConfig:
        CertificateArn: ${self:custom.certificateArn}
CognitoUserPoolDomain.yml#L1
Type: AWS::Cognito::UserPoolDomain
Properties:
  UserPoolId:
    Ref: CognitoUserPool
CognitoUserPooldomain.yml#L1
Type: AWS::Cognito::UserPoolDomain
Properties:
  Domain: ${self:provider.stage}-${self:service}
  UserPoolId:
serverless-state.json#L84
            "Type": "AWS::Cognito::UserPoolDomain",
            "Properties": {
              "Domain": "alexa-time-bot",
              "UserPoolId": {
                "Ref": "timeBotUserPool"
              }
cognito-cloudformation.json#L57
            "Type" : "AWS::Cognito::UserPoolDomain",
            "Properties" : {
                "Domain" : "expressboilerplateclientpool",
                "UserPoolId" : {
                    "Ref": "expressboilerplatecognito"
                }
CognitoUserPoolDomainSpecification.json#L3
    "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",
2.clf-cognnito-domain.json#L17
      "Type" : "AWS::Cognito::UserPoolDomain",
      "Properties" : {
          "Domain" : {"Ref": "DomainName"},
          "UserPoolId" : {"Ref": "UserPoolId"}
      }
    }
serverless-state.json#L122
            "Type": "AWS::Cognito::UserPoolDomain",
            "Properties": {
              "UserPoolId": {
                "Ref": "serviceUserPool"
              },
              "Domain": "space-user-pool-domain-dev-space-auth"

Parameters

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.