DEV Community

Garett Dunn
Garett Dunn

Posted on • Originally published at garettmd.com on

AWS EC2 - Limit an Instance's Access to its Own Tags

Here’s a dynamic way to allow an EC2 instance to modify its own tags, but no other instance’s. Enjoy.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["ec2:CreateTags", "ec2:DescribeTags"],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:ARN": "${ec2:SourceInstanceARN}"
        }
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay