🏖️

Amplifyを使ってみた-サンドボックス環境作成-

に公開

サンドボックス環境を作ってみる

公式ドキュメントの言う通りに進めていく。
(今回はサンドボックス環境を作るとこまでなので、「Build a backend」の手前まで。)
https://docs.amplify.aws/nextjs/build-a-backend/server-side-rendering/nextjs-app-router-server-components/

Amplifyを使うためのAWSアカウントの設定についても言われた通りに進めてみる。
https://docs.amplify.aws/nextjs/start/account-setup/

サンドボックス環境作成コマンドでエラー

npx ampx sandbox
<省略>
[SSMCredentialsError] UnrecognizedClientException: The security token included in the request is invalid
  ∟ Caused by: [UnrecognizedClientException] The security token included in the request is invalid
Resolution: Make sure your AWS credentials are set up correctly and have permissions to call SSM:GetParameter

ssoログインもしてるし、言われた通りにやったのに...

プロファイルを確認してみる

cat .aws/config

[default]
sso_session = amplify-admin
sso_account_id = <your-aws-account-id>
sso_role_name = AdministratorAccess
region = <your-region>

configのプロファイルの記載が[default]のみだった。
[profile default]としてあげたら解決。

作られたリソースを確認してみる

コンソール > cfn を確認すると、それっぽいスタックが1つ、「ネストされた」と書かれたそれっぽいスタックが複数作られている。
リソースを実際に作っているのは「ネストされた」スタックみたいなので、これを確認してみると、CognitoやらAppSyncやらがなんだかたくさん作られていた。

Discussion