neversaint
neversaint

Reputation: 64024

How do you create root credential in ~/.aws/credential file

My current credential looks like this:

$ cat > ~/.aws/credentials
[default]
aws_access_key_id = AKID1234567890
aws_secret_access_key = MY-SECRET-KEY

How can I add root credential in that file? As suggested by this page.

Upvotes: 1

Views: 2089

Answers (2)

Mathieu J.
Mathieu J.

Reputation: 2115

You don't need and you should not.

EC2 instances should have an IAM role assigned in lieu of having credentials stored in plain text.

Go to your AWS Console, IAM section, go under role. Find the role assign to the EC2 instance that matters to you. In my case I wanted to edit the role for Elastic Beanstalk

https://console.aws.amazon.com/iam/home?region=us-east-1#/roles/aws-elasticbeanstalk-ec2-role

And I wanted to be able to edit ec2 tags. So I added that policy to my role.

aws policies for beanstalk role

Upvotes: 0

Niceha
Niceha

Reputation: 384

If you want to run the aws commands as root user instead of other-user then you should install and configure aws using root. In that case the aws credentials and config file will be saved in /root/.aws/ and you will be able to run aws commands from root user only.

Upvotes: 3

Related Questions