0
0
AWScloud~30 mins

Amazon Machine Images (AMIs) in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
Amazon Machine Images (AMIs)
📖 Scenario: You are setting up a cloud environment where you want to create a custom Amazon Machine Image (AMI) to launch virtual servers with your preferred software and settings.
🎯 Goal: Build a simple AWS CloudFormation template step-by-step that defines an EC2 instance and creates an AMI from it.
📋 What You'll Learn
Create a CloudFormation template with an EC2 instance resource
Add a parameter for the base AMI ID
Use the parameter to specify the AMI for the EC2 instance
Add a resource to create an AMI from the EC2 instance
💡 Why This Matters
🌍 Real World
Creating custom AMIs helps launch EC2 instances quickly with pre-installed software and settings, saving time and ensuring consistency.
💼 Career
Cloud architects and DevOps engineers often create and manage AMIs to optimize infrastructure deployment and maintenance.
Progress0 / 4 steps
1
Create the base CloudFormation template with an EC2 instance
Create a CloudFormation template with a resource named MyInstance of type AWS::EC2::Instance. Set the ImageId property to ami-0abcdef1234567890 and InstanceType to t2.micro.
AWS
Need a hint?

Define the Resources section with an EC2 instance named MyInstance. Use the exact AMI ID and instance type given.

2
Add a parameter for the base AMI ID
Add a Parameters section with a parameter named BaseAmiId of type AWS::EC2::Image::Id. Remove the hardcoded ImageId from MyInstance and instead reference the parameter BaseAmiId using !Ref BaseAmiId.
AWS
Need a hint?

Use the Parameters section to allow the AMI ID to be passed in. Reference it in the EC2 instance.

3
Add a resource to create an AMI from the EC2 instance
Add a resource named MyAmi of type AWS::EC2::Image. Set the InstanceId property to reference MyInstance using !Ref MyInstance. Set the Name property to MyCustomAMI.
AWS
Need a hint?

Use the AWS::EC2::Image resource to create an AMI from the EC2 instance.

4
Add a tag to the AMI resource
Add a Tags property to the MyAmi resource. Add a tag with Key set to Purpose and Value set to CustomImage.
AWS
Need a hint?

Tags help identify your AMI. Add the Tags property with the specified key and value.