Does anyone know of a way to create the following permission on AWS IAM:

  • Allows tagging of any EC2 instance, on the condition that:
    • The AMI from which the instance was created has the tag "foo" with the value "bar".

I can see how to create a general CreateTags permission, and a permission to tag a particular instance specified by instance id, but I'm so far struggling to find a way to create the restriction I want.

  • I tried adding "Condition": {"StringEquals": {"iam:ResourceTag/Environment": "${var.environment}"}} but so far no luck – Daryl Banttari Feb 22 at 22:54

Add this to your policy:

"Condition": {"StringEquals": {"ec2:ResourceTag/foo": "bar"}}

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.