CLIのインストール

Nodeのバージョン確認

nodeについてはCloud9にすでにインストール済みなので確認のみとなります。 Cloud9のターミナルで以下のコマンドを実行してください

node -v

v16.18.1と表示されたらそのまま進みます。

Amplify CLIのインストール

Amplifyのインストールを進めていきます。 Cloud9のターミナルで以下のコマンドを実行してください

npm install -g @aws-amplify/cli

次にAmplifyのセットアップを行うため、以下のコマンドを実行してください

amplify configure

このようにSession Identifierが表示されたらEnterキーを押します。

Follow these steps to set up access to your AWS account:

Sign in to your AWS administrator account:
https://console.aws.amazon.com/
Press Enter to continue
🛑 spawn xdg-open ENOENT

Resolution: Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: c8409a47-d71c-448a-99e5-xxxxxxxxxxxxxx

リージョンを聞かれるので東京リージョンであるap-northeast-1を選択して、Enterを押します。

Specify the AWS Region
? region:  
  eu-west-2 
  eu-west-3 
  eu-central-1 
❯ ap-northeast-1 
  ap-northeast-2 
  ap-southeast-1 
  ap-southeast-2 
(Move up and down to reveal more choices)

次に作成されるIAMユーザー名を聞かれるのでamplify-hansonとします。

Specify the username of the new IAM user:
? user name:  amplify-hanson

ユーザー名を設定すると、以下のようなURLが発行されます。 発行されたURLを押し、次の画面に移動します。

Complete the user creation using the AWS console
https://console.aws.amazon.com/iam/home?region=ap-northeast-1#/users$new?step=final&accessKey&userNames=amplify-hanson&permissionType=policies&policies=arn:aws:iam::aws:policy%2FAdministratorAccess-Amplify

IAMユーザーを作成する画面に遷移するので、そのまま次のステップ:アクセス権限を押します。

ポリシーについてもAdministratorAccess-Amplifyが付与されていることを確認して、次のステップ:タグを押します。

タグは特に指定しないのでそのまま次のステップ:確認を押します。

ユーザー名がamplify-hansonであることと、管理ポリシーにAdministratorAccess-Amplifyがあることを確認したらユーザーの作成で先に進みます。

IAMユーザーが作成されたらアクセスキー IDシークレットアクセスキーを控えておきます。 CSVをダウンロードしておくのが良いです。

Cloud9に戻りEnterを押します。 次に先程作成したアクセスキー IDシークレットアクセスキーの入力を求めらるので入力します。

Enter the access key of the newly created user:
? accessKeyId:  ********************
? secretAccessKey:  ****************************************

次にProfile名を聞かれますが、今回はハンズオンで使うだけなのでデフォルトのまま進めます。 特に入力せずEnterを押すと、defaultとなります。  

Enter the access key of the newly created user:
? accessKeyId:  ********************
? secretAccessKey:  ****************************************
This would update/create the AWS Profile in your local machine
? Profile Name:  default

Successfully set up the new user.

ここまででCLIの準備は完了となります。

Last updated