0
0
AWScloud~30 mins

Elastic IP addresses in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
Elastic IP addresses
📖 Scenario: You are managing a small web application hosted on AWS. You want to assign a fixed public IP address to your EC2 instance so that users can always reach your server at the same IP, even if the instance is stopped and started.
🎯 Goal: Create an Elastic IP address resource and associate it with an EC2 instance using AWS CloudFormation.
📋 What You'll Learn
Create an Elastic IP resource with the name MyElasticIP.
Create an EC2 instance resource with the name MyEC2Instance.
Associate the Elastic IP MyElasticIP with the EC2 instance MyEC2Instance.
Use valid AWS CloudFormation syntax.
💡 Why This Matters
🌍 Real World
Elastic IPs are used to keep a fixed public IP for cloud servers, useful for DNS records and stable access.
💼 Career
Understanding Elastic IPs and CloudFormation templates is essential for cloud engineers managing AWS infrastructure.
Progress0 / 4 steps
1
Create an EC2 instance resource
Create a resource called MyEC2Instance of type AWS::EC2::Instance with the property ImageId set to ami-0abcdef1234567890.
AWS
Need a hint?

The Resources section defines AWS resources. Use the exact resource name MyEC2Instance and set ImageId to the given AMI ID.

2
Create an Elastic IP resource
Add a resource called MyElasticIP of type AWS::EC2::EIP under Resources.
AWS
Need a hint?

Elastic IPs are defined with type AWS::EC2::EIP. Use the exact resource name MyElasticIP.

3
Associate the Elastic IP with the EC2 instance
Add a resource called MyEIPAssociation of type AWS::EC2::EIPAssociation that associates MyElasticIP with MyEC2Instance using the properties AllocationId and InstanceId referencing the correct resources.
AWS
Need a hint?

Use AWS::EC2::EIPAssociation to link the Elastic IP to the EC2 instance. Use !GetAtt MyElasticIP.AllocationId and !Ref MyEC2Instance for properties.

4
Add Outputs for the Elastic IP address
Add an Outputs section with an output called ElasticIPAddress that returns the public IP of MyElasticIP using !Ref MyElasticIP.
AWS
Need a hint?

The Outputs section lets you see the Elastic IP after deployment. Use !Ref MyElasticIP to get the IP address.