LoginSignup
0
0

More than 3 years have passed since last update.

AWS CLIを初めて使う。ローカルから疎通確認。

Last updated at Posted at 2021-01-24

AWS CLI

インストール
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

IAMロール作成

ルートユーザ使用はおすすめしないみたいなので、IAMロール作成。
既存のポリシーを直接アタッチでAdministratorAccessをチェック
(本当はAdminでなく権限絞った方が良いらしい)
認証情報のCSVをダウンロードしておく。

AWS CLIのプロファイル作成

適当なプロファイル名をつけてプロファイル作成。


$ aws configure --profile PROFILE1
AWS Access Key ID[None]: アクセスキーID
AWS Secret Access Key[None]: シークレットアクセスキー
Default region name[None]: ap-northeast-1
Default output format[None]: json

確認

aws sts get-caller-identity --profile PROFILE1

毎回指定しなくてすむようにprofileを環境変数に設定しておく(以下Macの場合)

vi ~/.bash_profile

.bash_profileに追記

export AWS_PROFILE=PROFILE1

疎通確認

$ aws ec2 describe-vpcs

結果が表示されればOK

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0