1

I have deployed 2 services using aws CDK typescript. One of the services by default got listed in Tags of AWS Cost Explorer service:

enter image description here

So I tried to add tag to another service :

export class CdkStack extends cdk.Stack {
    constructor(scope: cdk.Construct, id: string, props: scStackProps<ICdkStackProps>) {
        super(scope, id, props);

        const {config, context} = props;
        const vpc = ec2.Vpc.fromLookup(this, "vpc", {
            vpcName: "baseInfrastructure/vpc",
        });
        cdk.Tags.of(this).add("aws:cloudformation:stack-name", `${config.container.name}`);

But got the error in the Cloudformation stack:

UPDATE_FAILED   aws: prefixed tag key names are not allowed for external use.

So please let me know where I am wrong and how to fix this issue so that I can see my both services in AWS Cost Explorer tags.

Ashish Karpe
  • 5,087
  • 7
  • 41
  • 66

1 Answers1

1

As the message says, you cannot create aws:-prefixed tags, only AWS can manage those.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html

These tags are created automatically and propagated to all supported resources. Create your own custom tags if that is not sufficient.

gshpychka
  • 8,523
  • 1
  • 11
  • 31
  • I have created my own custom tags but those are not reflected in cost explorer, so I am curious why this automatically created tag is missing for me that also for only for 1 service aut of 2 so is there any way to troubleshoot this automatically created tag why it's missing – Ashish Karpe Nov 08 '21 at 01:41