hello
Last active
July 1, 2024 14:15
-
-
Save jhw/339859004221f36b6e034fe74d4b0576 to your computer and use it in GitHub Desktop.
Cognito Google federated auth deploy test
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
env | |
*.pyc | |
__pycache__ | |
tmp | |
setenv-priv.sh |
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
AppName=polyreader-social-demo |
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
#!/usr/bin/env bash | |
. app.props | |
aws cloudformation delete-stack --stack-name $AppName |
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
#!/usr/bin/env bash | |
. app.props | |
aws cloudformation deploy --stack-name $AppName --template-file stack.json --capabilities CAPABILITY_NAMED_IAM --parameter-overrides DomainName=$DOMAIN_NAME GoogleClientId=$GOOGLE_CLIENT_ID GoogleClientSecret=$GOOGLE_CLIENT_SECRET | |
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
#!/usr/bin/env bash | |
. app.props | |
aws cloudformation describe-stack-events --stack-name $AppName --query "StackEvents[].{\"1.Timestamp\":Timestamp,\"2.Id\":LogicalResourceId,\"3.Type\":ResourceType,\"4.Status\":ResourceStatus,\"5.Reason\":ResourceStatusReason}" |
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
#!/usr/bin/env bash | |
. app.props | |
aws cloudformation describe-stacks --stack-name $AppName --query 'Stacks[0].Outputs' --output table |
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
#!/usr/bin/env bash | |
. app.props | |
aws cloudformation describe-stack-resources --stack-name $AppName --query "StackResources[].{\"1.Timestamp\":Timestamp,\"2.LogicalId\":LogicalResourceId,\"3.PhysicalId\":PhysicalResourceId,\"4.Type\":ResourceType,\"5.Status\":ResourceStatus}" |
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
#!/usr/bin/env bash | |
aws cloudformation describe-stacks --query "Stacks[].{\"1.Name\":StackName,\"2.Status\":StackStatus}" |
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
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
awscli | |
botocoro | |
boto3 | |
pyyaml |
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
#!/usr/bin/env bash | |
export AWS_DEFAULT_OUTPUT=table | |
export AWS_PROFILE=#{your-aws-profile-here} | |
export AWS_REGION=#{your-aws-region-here} | |
export DOMAIN_NAME=#{your-domain-name-here} | |
export GOOGLE_CLIENT_ID=#{your-google-client-id-here} | |
export GOOGLE_CLIENT_SECRET=#{your-google-client-secret-here} | |
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
{ | |
"Outputs": { | |
"AppUserPool": { | |
"Value": { | |
"Ref": "AppUserPool" | |
} | |
}, | |
"AppUserPoolClient": { | |
"Value": { | |
"Ref": "AppUserPoolClient" | |
} | |
}, | |
"AppUserPoolDomain": { | |
"Value": { | |
"Ref": "AppUserPoolDomain" | |
} | |
} | |
}, | |
"Parameters": { | |
"DomainName": { | |
"Type": "String" | |
}, | |
"GoogleClientId": { | |
"Type": "String" | |
}, | |
"GoogleClientSecret": { | |
"Type": "String" | |
} | |
}, | |
"Resources": { | |
"AppUserPool": { | |
"Properties": { | |
"AutoVerifiedAttributes": [ | |
"email" | |
], | |
"Policies": { | |
"PasswordPolicy": { | |
"MinimumLength": 8, | |
"RequireLowercase": true, | |
"RequireNumbers": true, | |
"RequireSymbols": true, | |
"RequireUppercase": true | |
} | |
}, | |
"Schema": [ | |
{ | |
"AttributeDataType": "String", | |
"Mutable": true, | |
"Name": "email", | |
"Required": true, | |
"StringAttributeConstraints": { | |
"MinLength": "1" | |
} | |
}, | |
{ | |
"AttributeDataType": "String", | |
"Mutable": true, | |
"Name": "foo" | |
} | |
], | |
"UsernameAttributes": [ | |
"email" | |
], | |
"UsernameConfiguration": { | |
"CaseSensitive": false | |
} | |
}, | |
"Type": "AWS::Cognito::UserPool" | |
}, | |
"AppUserPoolClient": { | |
"Properties": { | |
"CallbackURLs": [ | |
{ | |
"Fn::Sub": "https://${AppUserPoolDomain}.auth.${AWS::Region}.amazoncognito.com/oauth2/idpresponse" | |
} | |
], | |
"ExplicitAuthFlows": [ | |
"ALLOW_USER_SRP_AUTH", | |
"ALLOW_ADMIN_USER_PASSWORD_AUTH", | |
"ALLOW_REFRESH_TOKEN_AUTH" | |
], | |
"LogoutURLs": [ | |
{ | |
"Fn::Sub": "https://${DomainName}" | |
} | |
], | |
"PreventUserExistenceErrors": "ENABLED", | |
"SupportedIdentityProviders": [ | |
"COGNITO", | |
"Google" | |
], | |
"UserPoolId": { | |
"Ref": "AppUserPool" | |
} | |
}, | |
"Type": "AWS::Cognito::UserPoolClient" | |
}, | |
"AppUserPoolDomain": { | |
"Properties": { | |
"Domain": { | |
"Fn::Sub": "${AWS::StackName}" | |
}, | |
"UserPoolId": { | |
"Ref": "AppUserPool" | |
} | |
}, | |
"Type": "AWS::Cognito::UserPoolDomain" | |
}, | |
"GoogleUserPoolIdentityProvider": { | |
"Properties": { | |
"ProviderDetails": { | |
"authorize_scopes": "openid email profile", | |
"client_id": { | |
"Ref": "GoogleClientId" | |
}, | |
"client_secret": { | |
"Ref": "GoogleClientSecret" | |
} | |
}, | |
"ProviderName": "Google", | |
"ProviderType": "Google", | |
"UserPoolId": { | |
"Ref": "AppUserPool" | |
} | |
}, | |
"Type": "AWS::Cognito::UserPoolIdentityProvider" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment