Created
February 26, 2020 13:50
-
-
Save georgmao/b04daf5e0708187b15e50c17bd5d40ff to your computer and use it in GitHub Desktop.
Example CloudFormation template for automated Amazon Cognito Deployments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: "2010-09-09" | |
Parameters: | |
CognitoDomain: | |
Type: String | |
MinLength: 3 | |
MaxLength: 63 | |
AllowedPattern: ^[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?$ | |
Description: Enter a string. Must be alpha numeric 3-63 in length. | |
Resources: | |
UserPool: | |
Type: AWS::Cognito::UserPool | |
Properties: | |
UsernameConfiguration: | |
CaseSensitive: false | |
AutoVerifiedAttributes: | |
UserPoolName: !Sub ${CognitoDomain}-user-pool | |
Schema: | |
- Name: email | |
AttributeDataType: String | |
Mutable: false | |
Required: true | |
- Name: name | |
AttributeDataType: String | |
Mutable: true | |
Required: true | |
UserPoolClient: | |
Type: AWS::Cognito::UserPoolClient | |
Properties: | |
UserPoolId: !Ref UserPool | |
AllowedOAuthFlowsUserPoolClient: true | |
CallbackURLs: | |
- http://localhost:3000 | |
AllowedOAuthFlows: | |
- code | |
- implicit | |
AllowedOAuthScopes: | |
- phone | |
- openid | |
- profile | |
SupportedIdentityProviders: | |
- COGNITO | |
UserPoolDomain: | |
Type: AWS::Cognito::UserPoolDomain | |
Properties: | |
Domain: !Ref CognitoDomain | |
UserPoolId: !Ref UserPool | |
Outputs: | |
CognitoUserPoolID: | |
Value: !Ref UserPool | |
Description: The UserPool ID | |
CognitoAppClientID: | |
Value: !Ref UserPoolClient | |
Description: The app client | |
HostedUIURL: | |
Value: !Sub https://${CognitoDomain}.auth.us-west-2.amazoncognito.com/login?client_id=${UserPoolClient}&response_type=code&scope=email+openid+phone+profile&redirect_uri=http://localhost:3000 | |
Description: The hosted UI URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment