Skip to content

Conversation

@wcvo
Copy link

@wcvo wcvo commented Dec 7, 2025

Adds support for configuring Cognito User Pool domains via domain prop on CognitoUserPool. This addresses the feature request in #5220.

Features:

  • Cognito prefix domains (e.g., my-app.auth.us-east-1.amazoncognito.com)
  • Custom domains with automatic ACM certificate creation and DNS configuration
  • Multiple DNS providers (Route 53, Cloudflare, Vercel)
  • Option to use existing certificates

Usage:

// Prefix domain
new sst.aws.CognitoUserPool("MyUserPool", {
   domain: {
      prefix: "my-app-dev"
   }
});

// Custom domain with Route 53
new sst.aws.CognitoUserPool("MyUserPool", {
   domain: "auth.example.com"
});

// Custom domain with Cloudflare
new sst.aws.CognitoUserPool("MyUserPool", {
   domain: "auth.example.com"
   dns: sst.cloudflare.dns()
});

Test plan

  • Tested prefix domain creation
  • Tested custom domain creation
  • Tested domain change (deleteBeforeReplace)

@jamesgibbons92
Copy link
Collaborator

Good contribution @wcvo !
Is there a reason you chose a method addDomain(), over just adding a domain prop to the user pool component? I think a prop makes more sense and fits the pattern used in other sst components which support custom domains

@wcvo
Copy link
Author

wcvo commented Dec 8, 2025

@jamesgibbons92 Valid point! I initially went with a method to match the existing addClient() and addIdentityProvider() patterns in the component, but you're right that a prop makes more sense since a User Pool can only have one domain (vs multiple clients/providers). Will update shortly.

@dimitor115
Copy link
Contributor

Nice work! I’ve been looking for this 😄 If I may suggest: since this is such a convenient setup, it’d be great to include the domain usage in the aws-cognito example as well. It should render correctly once my other PR is merged.

@vimtor vimtor requested review from vimtor and removed request for vimtor December 10, 2025 12:43
Adds a `domain` prop to configure Cognito User Pool domains for the hosted UI.
Supports prefix domains and custom domains with automatic certificate/DNS setup.

Closes anomalyco#5220
@wcvo wcvo force-pushed the feat/cognito-user-pool-domain branch from 895b38f to c1e4573 Compare December 13, 2025 05:36
@vimtor
Copy link
Collaborator

vimtor commented Dec 13, 2025

let's wait on merging #6271 first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants