Skip to content
Antenore Gatta

Antenore Gatta

A proud and busy Hacker, Father and Kyndryl.

A 'tag-only' IAM role is never tag-only

- 1 min

A “tag-only” IAM role is never actually tag-only. The Resource Groups Tagging API is a pass-through, so TagResources also needs each service’s own tag action, and a TagKeys condition can fail open.

A billing colleague needed to put a partner key on resources in every account. The shortcut was the existing admin role with tag:*. It could not tag anything, because tag:TagResources alone is not enough: each service needs its own action, like ec2:CreateTags or rds:AddTagsToResource.

We built a dedicated role, tagging-role, deployed with a StackSet to all members: read-only access plus an inline policy holding the tag actions of all the relevant services, locked with ForAllValues on TagKeys to the partner keys only. It carries no SCP-exemption tag, and the SCP protects the role by name. Some gaps we accepted and documented. For services that don’t populate aws:TagKeys, the lock fails open; the widest is elasticbeanstalk:UpdateTagsForResource. CodeBuild has no tag-only action, only UpdateProject. API Gateway needs a PATCH or POST guarded by a Null TagKeys condition.

ForAllValues rejects a whole call that mixes the partner key with any other key. That’s what made Tag Editor say denied. And a StackSet never lands in the management account, so the role doesn’t exist there.

For bulk work, tag-resources takes at most 20 ARNs per call, so batch per region. On S3 it adds the key and keeps the bucket’s other tags. Tagging a Lambda bumps its LastModified, which confuses people looking for who changed the function.

This sounds like a ten-minute IAM job. The pass-through permissions, fail-open conditions, and per-service exceptions decide what the role can really do, so write the gaps into the change record.

Drafted with AI assistance from notes I took during real work.

Antenore Gatta

Antenore Gatta

A proud and busy Hacker, Father and Kyndryl

Support This Work

If this saved you from a tag-only role that quietly tags everything, consider a small contribution.

Most readers scroll past. Less than 3% of readers contribute to keeping independent technical content free and accessible.

Post comment

Markdown is allowed, HTML is not. All comments are moderated.