動作環境
OS | Parott OS |
バージョン | 5.3 Electro Ara |
仮想化ソフト | Oracle VM VirtualBox |
AWS CLI インストール
Install or update to the latest version of the AWS CLI - AWS Command Line Interface
Instructions to install or update the AWS CLI on your system.
AWS CLIをcurlコマンド、もしくは公式ドキュメントに記載のhttps://awscli.amazonaws.com/awscli-exe-linux-x86_64.zipからダウンロードする。
curlコマンドでzipファイルを取得
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzipで解凍
unzip awscliv2.zip
権限付与
sudo ./aws/install
インストール確認
aws --version

AWS CLI 設定
AWS CLIを使用してAWSと対話するための設定を行う。
AWSマネジメントコンソール上で作成したIAMユーザー認証情報を使用します。
Set up the AWS CLI - AWS Command Line Interface
Install the AWS Command Line Interface version 2 (AWS CLI version 2) on your system.
認証情報の設定
aws configure
AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxxx
AWS Secret Access Key [None]: xxxxxxxxxxxxxxx
Default region name [None]: リージョン名
Default output format [None]: json

認証情報の設定確認
認証情報の設定ファイルの階層に移動
cd ~/.aws
リージョン名とフォーマット
cat config

認証情報
cat credentials

AWSとの疎通確認
今回はIAMユーザーにec2のフルアクセスをアタッチしているので、ec2コマンドで疎通確認を行う。
aws ec2 describe-instances

IAMに適切なポリシーが設定されていない場合、アクセス拒否されます。
