📝
[小ネタ] amplify import auth では Amplify コンソールに Cognito ユーザープールの情報が表示されない
以下の挙動を確認しました。
-
amplify import authでは Amplify コンソールに Cognito ユーザープールの情報が表示されない -
amplify add authでは Amplify コンソールに Cognito ユーザープールの情報が表示される
前提
- コマンド実行環境は Cloud9
- インポートする Cognito ユーザープールは作成済み
- クライアントシークレットなしのクライアントも作成済み
amplify import auth での検証
# Amplify CLI のインストール
$ mkdir -p ~/.npm-global
$ npm config set prefix '~/.npm-global'
$ echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
$ source ~/.bashrc
$ npm install -g @aws-amplify/cli
$ amplify init
# アクセスキーやリージョンを設定
# 既存のユーザープールをインポート
$ amplify import auth
Using service: Cognito, provided by: awscloudformation
✔ What type of auth resource do you want to import? · Cognito User Pool only
✔ Select the User Pool you want to import: · ap-northeast-1_XKPBYS09d
✔ Only one Web app client found: 'test' was automatically selected.
✔ Only one Native app client found: 'test' was automatically selected.
⚠️ ⚠️ It is recommended to use different app client for web and native application.
✔ Federated identity providers are not configured, no OAuth configuration needed.
✅ Cognito User Pool 'User pool - 23z8ou' was successfully imported.
$ amplify push
Deployment state saved successfully.
デプロイ完了後に Amplify コンソールからバックエンドの認証を確認してもユーザープールに関する情報は表示されません。

amplify add auth での検証
$ amplify add auth
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 environment21e0b5fc locally
$ amplify push
Deployment state saved successfully.
デプロイ完了後に Amplify コンソールからバックエンドの認証を確認するとユーザープールに関する情報が表示されます。

まとめ
今回は amplify import auth では Amplify コンソールに Cognito ユーザープールの情報が表示されないという挙動を紹介しました。
どなたかの参考になれば幸いです。
Discussion