This template creates a custom domain, "my-test-user-pool-domain" for the Cognito user pool referenced by the UserPool parameter. The template also requires a certificate referenced by CertificateArn

CloudFormation Template

AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Custom Domain Example
Parameters:
  UserPool:
    Type: String
  CertificateArn:
    Type: String
Resources:
  UserPoolDomain:
    Type: 'AWS::Cognito::UserPoolDomain'
    Properties:
      UserPoolId:
        Ref: undefined
      Domain: undefined
      CustomDomainConfig:
        CertificateArn:
          Ref: undefined