LoginSignup
1
0

More than 3 years have passed since last update.

【AWS】aws configure コマンド実行で、.aws配下に設定ファイルが作成される

Last updated at Posted at 2020-07-26

aws configure コマンド

aws configure
このコマンドを実行すると、認証情報、リージョン、出力形式をすばやく設定および表示できます。

$ aws configure
AWS Access Key ID [None]: AKI*************PLE
AWS Secret Access Key [None]: wJa***********************************KEY
Default region name [None]: ap-northeast-1
Default output format [None]: json

この設定の保存先

bundle installでオプション(例えば--path vendor/bundle)を追加すると .bundle/configに設定が保存されるのと同じ要領で、
aws configure コマンド実行後、ホームディレクトリーに.aws というディレクトリーが作成され、設定ファイルが格納されます。

[root@vanilla ~]# ls -a
.  ..  .bash_logout  .bash_profile  .bashrc  .cshrc  .ssh  .tcshrc 
###
###↑.awsディレクトリーは存在しない
[root@vanilla ~]#
[root@vanilla ~]#
[root@vanilla ~]# aws configure
AWS Access Key ID [None]: AKI*************PLE
AWS Secret Access Key [None]: wJa***********************************KEY
Default region name [None]: ap-northeast-1
Default output format [None]: json
[root@vanilla ~]#
[root@vanilla ~]#
[root@vanilla ~]# ls -a
.  ..  .aws  .bash_logout  .bash_profile  .bashrc  .cshrc  .ssh  .tcshrc
###
###↑.awsディレクトリーが作成された
[root@vanilla ~]#
[root@vanilla ~]# cat .aws/credentials
[default]
aws_access_key_id = AKI*************PLE
aws_secret_access_key = wJa***********************************KEY
[root@vanilla ~]#
[root@vanilla ~]# cat .aws/config
[default]
output = json
region = ap-northeast-1

AWS CLIは設定ファイルから認証情報を読み取るので、
aws configure をしなくても、そのまま.awsディレクトリーと設定ファイルを作成すれば事足ります。

例えばChefなどのIaCツールで自動的にEC2インスタンスを立ち上げたい場合は、
「.awsディレクトリー配下に設定ファイルを作成する」という記述でOK。

1
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
1
0