Cloudformation Stack Update Fails Due to Duplicate Tags Errors on IAM Role Resource

0

My stack has some tags that I can see on the "Stack Info" dashboard. The IAM Role resource I am trying to add to the stack does not use any tags. Nevertheless, I get the following error during the stack update at the Role's creation:

Duplicate tag keys found. Please note that Tag keys are case insensitive. (Service: AmazonIdentityManagement; Status Code: 400; Error Code: InvalidInput; Request ID: 2e1c1359-cfa9-4f6b-9571-0b302df35355; Proxy: null)

I don't really know what could be causing this. Thanks for your help!

2 Answers
2
Accepted Answer

Hi,

The error message "Duplicate tag keys found. Please note that Tag keys are case insensitive" occurs when there are duplicate tag keys in the IAM Role resource being created, even if the keys have different cases. Check this out:

https://docs.aws.amazon.com/it_it/IAM/latest/UserGuide/access_tags.html

BTW, this error can occur even if the IAM Role resource does not use any tags. To prevent duplicate tags with a key that varies only by case, use the "aws:TagKeys" condition to define the tag keys that your users can apply, or use tag key-name condition key to specify what tag key-value pairs can be passed in a request to tag or untag an AWS resource

You can check all the resources in the stack that have tags defined and verify if any of them have duplicate tag keys. To do this, you can navigate to the CloudFormation console, select your stack, and view the "Resources" tab. From there, you can expand each resource and look for tags.

profile pictureAWS
answered a year ago
profile picture
EXPERT
reviewed 2 months ago
profile picture
EXPERT
reviewed 2 months ago
  • Thank you Stefano. There seems to be duplicate keys in our json config file. Do you know how to define "stack-level" tags inside the yml file?

0

Hi, To define stack-level tags in a CloudFormation YAML file, you can use the Tags property at the root level of your template. Here's an example:

AWSTemplateFormatVersion: '2010-09-09' Description: Your CloudFormation stack description Tags: StackLevelTag1: StackLevelValue1 StackLevelTag2: StackLevelValue2 Resources: ...

Make sure to replace StackLevelTag1, StackLevelValue1, etc. with your actual tag key-value pairs. Remember that stack-level tags are not specific to any particular resource. They are used to provide metadata at the stack level. Also, remember to adjust the resource type (AWS::EC2::Instance in the example) and properties according to your resource's definition.

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions