I would like to set a user-data script on my EC2 instances like this:


However the resource is acl private and cannot be accessed without credentials.

There are multiple solutions to this issue, such as using curl modified to compute credentials to append in a request or tools like s3cmd, all of which reads credentials stored somewhere.

I would like to know if IAM can help here, given this is a autoscale configuration, in getting and executing this file.

I was reading here: http://aws.amazon.com/iam/

Introducing roles for EC2 instances

Roles for EC2 instances is a new feature that makes it easier for you to securely access AWS services from within your EC2 instances. It ensures that you automatically will have valid AWS access keys on your EC2 instances, and makes it easier for you to control the AWS service permissions you want to grant to applications running on your EC2 instances. To the right is a short video that illustrates how easy it is to get started. Visit the Working with roles section in the Using IAM guide for more details.

Will it work in a situation like this?


Well, once a IAM role has been set one can perform a GET to the appropriate internal endpoint to get the credentials, so the answer is yes.

Hope it helps someone else.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.