In my AWS account we have 3 different applications, A, B, C.
I want to create an IAM policy for the B team that allows them to create new EC2 instances, but limit it to be tagged within the B resource group, or some other constraint that can definitively associate that new instance with the B group. Is that possible?
Yes, this is absolutely possible with IAM, using the
Condition
element. The Condition element lets you build expressions in which you can use Boolean operators to match against a condition, which in your case will be a resource with a specific tag.For example, if you tag all the application B resources with "GroupB", the below IAM policy will restrict a user to being able to Start, Stop, and Reboot only EC2 resources that have that tag:
You can find more information on Resource Groups on the AWS "What Are Resource Groups" page.