We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Launch from Template

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.

Assignment

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.

  1. ssh-keygen -R YOUR_ELASTIC_IP
    
  2. ssh patientping
    
  3. 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.

Tip

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