Normally on AWS EC2 instances the aws credentials ie: aws_access_key_id and aws_secret_access_key are stored in ~/.aws, however, on amazon's distro Amazon Linux the aws cli is already configured with your secret key on launch. The credentials do not appear to be in an environment variable or in the .aws folder. So, where are the credentials stored on these machines and how are they setup on boot?

  • 1
    Did you assign an IAM role to the instance? – mbaird Aug 2 '16 at 20:19
  • AWS instances do not automatically get any credentials stored on disk at creation unless the user scripts put them there. – Karen B Aug 3 '16 at 1:02
  • Did you assign an IAM role to the instance? – Skaperen Aug 3 '16 at 2:44
  • I have an IAM role. When I assign the IAM role to ubuntu based instances I need to use my secret key with the AWS CLI. However, the same IAM role with Amazon Linux distro takes care of the authentication and I don't need to use the secret key. Basically I'm failing to understand what's specific to amazon's linux that allows this to happen. All other IAM and security roles are the same. – Josiah Olson Aug 3 '16 at 20:43

EC2 instances automatically get credentials using metadata service when the instance has an instance role assigned. (Configurable at launch time) So you do not have to worry about keys. http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy