Skip to content

Instantly share code, notes, and snippets.

@louislatreille
Created April 10, 2022 22:57
Show Gist options
  • Save louislatreille/122f0e4c2aaadc15c15d62e471d13813 to your computer and use it in GitHub Desktop.
Save louislatreille/122f0e4c2aaadc15c15d62e471d13813 to your computer and use it in GitHub Desktop.
Serverless Streamlined - cognitoUserPool.ts
import { varToString } from "./utilities";
export const createUserPool = () => {
const identityPoolRole = {
Type: "AWS::IAM::Role",
Properties: {
...
},
};
const userPool = {
Type: "AWS::Cognito::UserPool",
Properties: {
...
},
};
const client = {
Type: "AWS::Cognito::UserPoolClient",
Properties: {
...
},
};
const identityPool = {
Type: "AWS::Cognito::IdentityPool",
Properties: {
...
},
};
const identityPoolRoleAttachement = {
Type: "AWS::Cognito::IdentityPoolRoleAttachment",
Properties: {
...
},
};
return {
resources: {
userPool,
client,
identityPool,
identityPoolRole,
identityPoolRoleAttachement,
},
userPoolId: { Ref: varToString({ userPool }) },
userPoolArn: { "Fn::GetAtt": [varToString({ userPool }), "Arn"] },
clientId: { Ref: varToString({ client: client }) },
identityPoolId: { Ref: varToString({ identityPool }) },
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment