

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: EC2 Instance Configuration: Keys
incomplete
2: EC2 Instances
incomplete
3: AMIs and Instance Types
incomplete
4: Public IPs
incomplete
5: Elastic IPs
incomplete
6: Security Groups
incomplete
7: SSH to Our Server
incomplete
8: Deploy the PatientPing Site
incomplete
9: Open Web Traffic
incomplete
10: Creating and Using Your Own AMI
incomplete
11: Reserved Instances and Savings Plans
incomplete
12: Auto Scaling Groups
incomplete
13: Launch Template
incomplete
14: Launch from Template
incomplete
15: Spot Instances
incomplete
16: Stateful and Stateless Applications
incomplete
17: Optional Cleanup
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
The point of creating our launch template was so we could treat servers like cattle, not pets. Let's do that.
We'll terminate our patientping-web instance, and launch a brand new one from the patientping-web-launcher template to get the site back up. Because the AMI already has the app baked in, we'll basically just need to SSH back in and start the app.
Terminate the current PatientPing instance and launch a replacement from your launch template.
Cost check: You're replacing one t3.micro with another. No change in cost.
ssh-keygen -R YOUR_ELASTIC_IP
ssh patientping
cd ~/patientping-web
uv run patientping.py
Notice how much faster this was than the first time. No installing git, no cloning, no installing uv. The AMI had it all. That's the power of baking your app into a custom image.
Run and submit the CLI tests.
If you want to use the CLI instead:
# Terminate the old instance
aws ec2 terminate-instances --instance-ids OLD-INSTANCE-ID
# Launch from template
aws ec2 run-instances --launch-template LaunchTemplateName=patientping-web-launcher --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=patientping-web-v2}]'
# Re-associate the Elastic IP
aws ec2 associate-address --instance-id NEW-INSTANCE-ID --allocation-id EIP-ALLOCATION-ID