how do I launch ec2-instance with iam-role?


I can launch ec2-instance with iam-role in management console.
But I have no idea how to launch ec2-instance with iam-role from aws-ruby-sdk

Here is the result:


The credentials you are using from your Ruby script do not have permission to launch an instance using the ‘test’ IAM Role. You need to modify the policy for this user, and grant it the IAM:PassRole permission, e.g.:

This is a security feature – it is possible to misconfigure IAM to allow privilege escalations, so AWS uses a “secure by default” policy.

You could also use this policy to allow your users to launch instances using any IAM role – but you should consider the security implications before doing this:


Leave a Reply