Skip to content
GitHub Discord

AWS Cognito User Pool

Create a Cognito User Pool with a hosted UI domain, client, and identity pool.

sst.config.ts
const userPool = new sst.aws.CognitoUserPool("MyUserPool", {
domain: {
prefix: `my-app-${$app.stage}`,
},
triggers: {
preSignUp: {
handler: "index.handler",
},
},
});
const client = userPool.addClient("Web", {
callbackUrls: ['https://example.com/auth/callback']
});
const identityPool = new sst.aws.CognitoIdentityPool("MyIdentityPool", {
userPools: [
{
userPool: userPool.id,
client: client.id,
},
],
});
index.ts
export async function handler() {}

View the full example.