How to provide tags for the stack in CloudFormation Template

0 votes

For billing purposes i want to use company specific Tags to the resources that i create in AWS . I am using a cloud formation template to spin up our Elastic Beanstalk instance and other resources. When I use the CloudFormation console to create a stack it asks me for Tags in the page after parameters. I have to manually input the Tags for that stack.

However is there a way to specify those Tags (Tags for the stack) with in the cloud formation template itself? That way the Tag gets propagated to the other resources?

Jul 27, 2018 in AWS by datageek
• 2,540 points
19,452 views

1 answer to this question.

0 votes

In the template anatomy, you cant set stack-level tags directly. However you can create a wrapper template, having a single resource of AWS::CloudFormation::Stack.

You can define stack-level tags on that resource:

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "WrapperTemplate",

  "Resources": {
    "WrappedStackWithStackLevelTags": {
      "Type" : "AWS::CloudFormation::Stack",
      "Properties" : {
        "Tags" : [ { "Key" : "Stage", "Value" : "QA" } ],
        "TemplateURL" : "your-original-template-s3-url"
      }
    }
  }
}
answered Aug 13, 2018 by bug_seeker
• 15,520 points

Is wrapper template going to be a main template and the original template going to be a nested template?

I tried to create a wrapper template as you suggested, then upload the wrapper template when update the stack from the Console, I got error that some resources such as LambdaExecutionRole, SNSTopic, LogGroup, ECSTaskRole etc cannot be created. 

My original template creates S3 bucket, Lambda function, SNSTopic, LogGroup etc.

Any idea is appreciated.

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer

How do I disable detailed monitoring for instances in an auto scaling group in a CloudFormation template?

The property you want is InstanceMonitoring, not ...READ MORE

answered Aug 31, 2018 in AWS by Archana
• 4,170 points

edited Jun 16, 2023 by Khan Sarfaraz 1,191 views
0 votes
1 answer

How to create new stack using create-change-set in AWS Cloudformation

The type of change set operation. To ...READ MORE

answered Sep 18, 2018 in AWS by Priyaj
• 58,100 points
3,859 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,941 views
+2 votes
1 answer
+5 votes
2 answers

Can we migrate the AWS Cognito users between the user pools?

Yes, it is possible that this scenario ...READ MORE

answered Apr 13, 2018 in AWS by Cloud gunner
• 4,670 points
10,519 views
+5 votes
2 answers

Can we export/migrate users from AWS cognito, does it cause vendor lock-in?

Cognito actually has the capability to import ...READ MORE

answered Aug 1, 2018 in AWS by bug_seeker
• 15,520 points
4,856 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP