How do I update my access key id from an old one on AWS CLI?

Viewed 1687

My goal is to access my s3 buckets from the command line using my AWS educate account.

I expected to get a list of my s3 buckets in the command prompt. I typed in this command. aws s3 ls

I actually received an error message saying Invalid Access Key ID. They shown do not match they key on the home age of my AWS educate account.

How do I change the keys listed to match the ones on my AWS Educate home page? I think if I correct this then I will be able to access my s3 buckets with aws cli.

1 Answers

Run:

aws configure

And follow the prompts to configure a new Access Key and Secret Access Key.

If this isn't working, there are two other things you can check:

  1. Have you set any of the following environment variables? https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html. These can override the ones set using aws configure
  2. If that fails, check that $HOME/.aws/credentials is not write protected, or even try updating the credentials manually.
Related