Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using new credentials for AWS ECR get-login

I'm already logged in to one ECR, but I want to change the credentials I am using to log in to a new ECR. But every time I call aws ecr get-login --no-include-email --region region it just logs in to the previous ECR.

How can I change the credentials it is using to make a new log in on the same machine?

like image 882
conv3d Avatar asked Sep 03 '25 05:09

conv3d


1 Answers

Do you have a default profile setup in your .awsconfig? If so, add another profile and reference it with aws ecr get-login --profile <new>. Or specify in the cmd line the actual AWS account credentials you want to generate the ECV login for.

edit You have .aws/config and .aws/credentials

/credentials


[default]
aws_access_key_id=AKASFDSDFSAF
aws_secret_access_key=dfgfdgdfg

[h]
aws_access_key_id=AKASFDSDFSAF
aws_secret_access_key=dsfdgfdg

[e]
aws_access_key_id=AKTRYUTRYTR
aws_secret_access_key=asfdiasjop



/config


[default]
output=json
region=eu-west-2

[profile h]
output=json
region=eu-west-2

[profile e]
output=json
region=eu-west-2

And reference these with --profile h, --profile e, and no profile (default)

like image 141
Tobin Avatar answered Sep 04 '25 20:09

Tobin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!