passing access and secret key aws cli

前端 未结 11 1017
旧巷少年郎
旧巷少年郎 2020-12-24 01:06

I am trying to embed access and secret key along with aws cli. e.g.

aws ec2 describe-instances --aws-access-key  --aws-secret-key 

        
11条回答
  •  执念已碎
    2020-12-24 01:41

    I had to access multiple accounts on Amazon....so my solution:

    under: ~/.aws/config

    [default] aws_access_key_id = xxxx aws_secret_access_key = xxxxxx region=sa-east-1 output=text

    [profile prof1] region=us-east-1 output=text aws_access_key_id = yyy aws_secret_access_key = yyyyy

    [profile prof2] region=us-east-1 output=text aws_access_key_id = wwwwww aws_secret_access_key = wwwww

    ..and then when evoke the aws CLI, i passed the parameter "--profile" as:

    /usr/local/bin/aws ec2 describe-security-groups --group-ids sg-xxxx --profile prof2

    ...that it!

提交回复
热议问题