At the moment I have 2 AWS IAM roles and each has 1 policy, call them Policy-A and Policy-B. I would like to attach both roles to an EC2 instance. Alternative is to create a new role which has both Policy-A and Policy-B.
Can I attach more than 1 IAM role to an EC2 instance?
An instance profile can contain only one IAM role. This limit cannot be increased.
An instance profile can contain only one IAM role, although a role can be included in multiple instance profiles. This limit of one role per instance profile cannot be increased. You can remove the existing role and then add a different role to an instance profile.
Technically, you can assume multiple IAM roles at the same time but the permissions will not be aggregated. Assuming an IAM role doesn't change who you are or what permissions you have.
Each instance profile can contain only one role, and that limit cannot be increased. If you create the role in the AWS Management Console, the instance profile is created for you with the same name as the role. For more information about instance profiles, see Using instance profiles.
This is a comment by krishna_mee2004, but it should be an answer:
You can attach only one role to ec2 instance. Refer this amazon document: IAM Roles for Amazon EC2. Instead:
- create 2 managed policies
- attach them to the same IAM Role.
- Attach that IAM Role to the EC2 instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With