passing access and secret key aws cli

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

    I think the previous answers are correct, here is my response which is more like Danh response but also including multiple options and Windows too

    Linux/Mac

    export AWS_ACCESS_KEY_ID=your_key; export AWS_SECRET_ACCESS_KEY=your_secret;  aws s3 ls 
    

    Another way to skin a cat for Linux/Mac

    AWS_ACCESS_KEY_ID=your_key AWS_SECRET_ACCESS_KEY=your_secret aws s3 ls 
    

    Windows Powershell

    $Env:AWS_ACCESS_KEY_ID="your_key"
    $Env:AWS_SECRET_ACCESS_KEY="your_secret"
    aws s3 ls  
    

    Full credit to great AWS document

提交回复
热议问题