0
0
AWScloud~30 mins

Cost optimization pillar in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
Cost Optimization Pillar in AWS
📖 Scenario: You are working as a cloud architect for a small company. Your task is to set up a simple AWS infrastructure that follows the cost optimization pillar best practices. This means you will create resources that are efficient and avoid unnecessary expenses.
🎯 Goal: Build a basic AWS infrastructure using AWS CloudFormation that includes a cost-effective EC2 instance and an S3 bucket with lifecycle rules to reduce storage costs.
📋 What You'll Learn
Create a CloudFormation template with a minimal EC2 instance using a t3.micro instance type
Add an S3 bucket with a lifecycle rule to transition objects to cheaper storage after 30 days
Use parameters to allow easy adjustment of instance type and lifecycle days
Ensure the template follows AWS best practices for cost optimization
💡 Why This Matters
🌍 Real World
Companies use cost optimization to reduce their cloud bills while maintaining performance and reliability.
💼 Career
Cloud architects and engineers must design infrastructure that balances cost and functionality to meet business goals.
Progress0 / 4 steps
1
Create the basic CloudFormation template structure
Create a CloudFormation template with the root keys AWSTemplateFormatVersion set to '2010-09-09' and Description set to 'Cost optimization example template'. Also, add an empty Resources section.
AWS
Need a hint?

Start with the basic keys of a CloudFormation template: version, description, and resources.

2
Add parameters for instance type and lifecycle days
Add a Parameters section with two parameters: InstanceType of type String with default t3.micro, and LifecycleDays of type Number with default 30.
AWS
Need a hint?

Parameters allow you to customize the template without changing the code.

3
Add a cost-effective EC2 instance resource
Add a resource named MyEC2Instance of type AWS::EC2::Instance with the property InstanceType set to { Ref: 'InstanceType' } and ImageId set to ami-0c02fb55956c7d316 (Amazon Linux 2 in us-east-1).
AWS
Need a hint?

Use the parameter InstanceType to set the EC2 instance type for cost savings.

4
Add an S3 bucket with lifecycle rule for cost savings
Add a resource named MyS3Bucket of type AWS::S3::Bucket with a LifecycleConfiguration that transitions objects to STANDARD_IA storage class after { Ref: 'LifecycleDays' } days.
AWS
Need a hint?

Use lifecycle rules to move data to cheaper storage after a set number of days.