あめがえるのITブログ

頑張りすぎない。ほどほどに頑張るブログ。

AWS AmplifyのBackend(Cognito)を作成してみた

やること

AmplifyでCognitoを作成する

前提

コマンド実行環境はWindows11を使用する

実践!

1.Cognito作成
1-1.PowerShellを実行
1-2.Amplifyのローカルフォルダに移動
1-3.下記を実行

> ampllify add auth

※すべてデフォルトを指定

> amplify add auth
Using service: Cognito, provided by: awscloudformation

 The current configured provider is Amazon Cognito.

 Do you want to use the default authentication and security configuration? Default configuration
 Warning: you will not be able to edit these selections.
 How do you want users to be able to sign in? Username
 Do you want to configure advanced settings? No, I am done.
✅ Successfully added auth resource amplify5236b512 locally

✅ Some next steps:
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud

1-4.下記を実行

> amplify push
> amplify push
√ Successfully pulled backend environment dev from the cloud.

    Current Environment: dev

┌──────────┬─────────────────┬───────────┬───────────────────┐
│ Category │ Resource name   │ Operation │ Provider plugin   │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Auth     │ amplify5236b512 │ Create    │ awscloudformation │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Function │ amplify6d148998 │ No Change │ awscloudformation │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Api      │ api9bb60a4c     │ No Change │ awscloudformation │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Storage  │ dynamo3c6a94e5  │ No Change │ awscloudformation │
└──────────┴─────────────────┴───────────┴───────────────────┘
√ Are you sure you want to continue? (Y/n) · yes

Deployment completed.
Deploying root stack amplify [ ================================-------- ] 4/5
        amplify-amplify-dev-5fd03      AWS::CloudFormation::Stack     UPDATE_IN_PROGRESS             Sun Jun 09 2024
        storagedynamo3c6a94e5          AWS::CloudFormation::Stack     UPDATE_COMPLETE                Sun Jun 09 2024
        functionamplify6d148998        AWS::CloudFormation::Stack     UPDATE_COMPLETE                Sun Jun 09 2024
        apiapi9bb60a4c                 AWS::CloudFormation::Stack     UPDATE_COMPLETE                Sun Jun 09 2024
        authamplify5236b512            AWS::CloudFormation::Stack     CREATE_COMPLETE                Sun Jun 09 2024
Deployed auth amplify5236b512 [ ======================================== ] 6/6
        UserPoolClientRole             AWS::IAM::Role                 CREATE_IN_PROGRESS             Sun Jun 09 2024
        UserPool                       AWS::Cognito::UserPool         CREATE_COMPLETE                Sun Jun 09 2024
        UserPoolClientWeb              AWS::Cognito::UserPoolClient   CREATE_COMPLETE                Sun Jun 09 2024
        UserPoolClient                 AWS::Cognito::UserPoolClient   CREATE_COMPLETE                Sun Jun 09 2024
        IdentityPool                   AWS::Cognito::IdentityPool     CREATE_COMPLETE                Sun Jun 09 2024
        IdentityPoolRoleMap            AWS::Cognito::IdentityPoolRol… CREATE_COMPLETE                Sun Jun 09 2024

Deployment state saved successfully.


2.作成確認
2-1.[AWS] - [Cognito] - [ユーザープール]

2-2.ユーザープールが作成されていること


感想

なるほどなるほど