问题
What is the command to edit secret key in aws configure
in terminal?
回答1:
Just type aws configure
again (or aws configure --profile <profile_name>
to edit a specific profile). If you just confirm the suggested value by hitting enter, it will remain unchanged.
or
Change just the aws_secret_access_key
by typing
$ aws configure set aws_secret_access_key <secret_key>
or
You can edit the AWS credentials directly by editing the AWS credentials file on your hard drive. The aws_access_key_id
and the aws_secret_access_key
are stored in the ~/.aws/credentials
file by default. You can use any editor to edit them, such as vim, emacs, or nano, e.g.
$ nano ~/.aws/credentials
Additionally, you can have credentials for many different AWS accounts in the same credentials file by using profiles. As a result, if you have one development
account and one production
account, the content of the file may look like
[development]
aws_access_key_id = <key id of dev account>
aws_secret_access_key = <secret access key of dev account>
[production]
aws_access_key_id = <key id of prod account>
aws_secret_access_key = <secret access key of prod account>
(naturally, you need to replace <key id of dev account>
, <secret access key of dev account>
, etc with the actual IAM credentials for each account respectively)
Ref: AWS CLI Configuration Variable
回答2:
aws configure set aws_secret_access_key <secret_key>
Docs
来源:https://stackoverflow.com/questions/53355333/how-to-edit-aws-credentials-in-terminal