Cognito ユーザー プールの CloudFormation テンプレートはすでに動作しており、API ゲートウェイに統合されています。しかし、ユーザー用のログイン ポータルを動作させるには、アプリ クライアント設定、ドメイン、フェデレーション ID を手動で構成する必要があります。これらを自動化する可能性のあるソリューションをあちこちで探していますが、それに近いものは見つからないようです。
アプリのクライアント設定、ドメイン、フェデレーション ID の構成を、手動で行う必要がないように、CloudFormation SAM テンプレートを使用して自動化したいと考えています。
ご提案があれば、ぜひお聞かせください。ありがとうございます。
(追加情報として添付ファイルを掲載しました)
ベストアンサー1
Cognito アプリのクライアント設定とドメイン名を適用するために、2 つの CloudFormation カスタム リソースを作成しました。これらのリソースを使用すると、次のようなスクリプトを作成できます。
UserPoolTestClient:
Type: 'AWS::Cognito::UserPoolClient'
Properties:
ClientName: UserPoolTestClient
GenerateSecret: true
UserPoolId: !Ref UserPoolTest
UserPoolTestClientSettings:
Type: 'Custom::CognitoUserPoolClientSettings'
Properties:
ServiceToken: !GetAtt CloudFormationCognitoUserPoolClientSettings.Arn
UserPoolId: !Ref UserPoolTest
UserPoolClientId: !Ref UserPoolTestClient
SupportedIdentityProviders:
- COGNITO
CallbackURL: 'https://www.amazon.com'
LogoutURL: 'https://www.google.com'
AllowedOAuthFlowsUserPoolClient: true
AllowedOAuthFlows:
- code
AllowedOAuthScopes:
- openid
UserPoolTestDomain:
Type: 'Custom::CognitoUserPoolDomain'
Properties:
ServiceToken: !GetAtt CloudFormationCognitoUserPoolDomain.Arn
UserPoolId: !Ref UserPoolTest
Domain: 'userpool-test-01'
完全なコードはここ。