0
0
AWScloud~30 mins

Resource tagging for cost tracking in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
Resource tagging for cost tracking
📖 Scenario: You work in a company that uses AWS cloud services. To keep track of costs, your team wants to tag resources with specific labels. These tags help identify which department or project owns each resource.For this project, you will create AWS EC2 instances with tags that specify the Department and Project. This will help the finance team track spending accurately.
🎯 Goal: Create an AWS CloudFormation template that launches an EC2 instance with the exact tags Department: Finance and Project: Budget2024. This template will be used to deploy tagged resources for cost tracking.
📋 What You'll Learn
Create a CloudFormation template with an EC2 instance resource
Add a parameter for the EC2 instance type
Add tags Department with value Finance and Project with value Budget2024 to the EC2 instance
Use best practices for CloudFormation syntax and structure
💡 Why This Matters
🌍 Real World
Tagging AWS resources helps companies track costs by department or project, making budgeting and billing clearer.
💼 Career
Cloud architects and engineers often create templates with tags to organize resources and enable cost allocation reports.
Progress0 / 4 steps
1
Create the basic CloudFormation template with EC2 instance
Create a CloudFormation template with a resource named MyEC2Instance of type AWS::EC2::Instance. Set the InstanceType property to t2.micro and use the Amazon Linux 2 AMI ID ami-0c55b159cbfafe1f0 for ImageId.
AWS
Need a hint?

Start with the Resources section. Define MyEC2Instance with the correct type and properties.

2
Add a parameter for the EC2 instance type
Add a Parameters section with a parameter named InstanceTypeParam. Set its type to String and default value to t2.micro. Then update the InstanceType property of MyEC2Instance to use this parameter with !Ref InstanceTypeParam.
AWS
Need a hint?

Define the parameter at the top level. Use !Ref InstanceTypeParam to refer to it in the instance properties.

3
Add tags for Department and Project to the EC2 instance
Add a Tags property under MyEC2Instance with two tags: one with Key as Department and Value as Finance, and another with Key as Project and Value as Budget2024.
AWS
Need a hint?

Tags are a list of key-value pairs under the Tags property.

4
Add Outputs section with the EC2 instance ID
Add an Outputs section with an output named InstanceId. Set its Value to !Ref MyEC2Instance and add a Description of EC2 Instance ID.
AWS
Need a hint?

The Outputs section helps you see important information after deployment.