passing access and secret key aws cli

前端 未结 11 925
旧巷少年郎
旧巷少年郎 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:34

    You can provide keys on the command line via envars:

    AWS_ACCESS_KEY_ID=ABCD AWS_SECRET_ACCESS_KEY=EF1234 aws ec2 describe-instances
    

    See http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#credentials

    EDIT: @wisbucky noted this could leave secrets in your command history. One way around this in bash at least I think is to prepend your command with a blank space and the command should not propagate to your bash history.

提交回复
热议问题