Launch a Baked AMI with Terraform
Bake an Ubuntu 24.04 AMI with a Packer manifest post-processor, wait until the AMI is available, launch it with Terraform 1.16.2, prove the baked nginx service, then destroy, deregister, and delete the snapshot.
Lab Overview
This is the hands-on lab for Section 12 of Packer 101. You bake a uniquely named AMI with Packer 1.16.0 and a manifest post-processor, hand the AMI id to Terraform via the manifest JSON, wait until EC2 reports state available (retrying InvalidAMIID.NotFound), and launch a t2.micro with hashicorp/aws 6.64.x. You prove the baked nginx page over HTTP, practice Azure and GCP Terraform snippets with terraform fmt only (no apply), then tear down in order: terraform destroy, deregister the AMI, delete the EBS snapshot.
You will:
- Confirm Packer 1.16.0, Terraform 1.16.2, and AWS credentials
- Build an AMI with a shell-provisioned nginx marker and a manifest.json
- Recover from InvalidAMIID.NotFound, wait for available, then terraform apply
- Prove the baked HTTP service and fmt Azure/GCP consumer .tf files
- Destroy the instance, deregister the AMI, and delete its snapshot
What You'll Learn
Confirm Packer 1.16.0 and Terraform 1.16.2 on the packer-host lab VM
Bake an AMI with a manifest post-processor and unique name prefix
Wait until AMI state is available and pass the id into Terraform from the manifest
Apply aws_instance with required_version ~> 1.16.0 and hashicorp/aws ~> 6.64, then prove nginx
Destroy the instance, deregister the AMI, and delete the snapshot in that order
Prerequisites
Completion of the Packer 101 Section 12 lessons on Terraform consumption
Prior Packer AWS labs (amazon-ebs bake and cleanup)
Basic Terraform vocabulary (init, apply, destroy, providers)
Technologies Covered
Part of a Course
This lab is part of the Packer 101 — Golden Images for AWS, Azure, and GCP course
View All CoursesChoose your plan
Simple, Transparent Pricing
Unlock full access to TeKanAid courses, labs, and bootcamps
Just exploring? Start free below. Want the full experience? Try Premium free for 7 days (card required, $0 today).
Pro
All courses, with lab scripts to run on your own machine
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Full access to all courses
- Lab scripts to download and run on your own machine (hosted labs not included)
- Progress tracking
- Certificate of completion
- Community access
- Self-paced bootcamps
- Premium puzzle library not included (5 free puzzles available)
- New content access
Premium
Full access, including unlimited hosted labs
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Everything in Pro
- Unlimited hands-on labs, fully hosted on TeKanAid Academy (nothing to set up)
- Full access to the puzzle library
- Lab AI Assistant
- Priority support
Prefer a single course?
Purchase individual courses for a one-time fee of $79. Full access to course content, quizzes, certificates, and community features, lab access is not included.
Browse CoursesJust exploring? Start free, no account needed
Three free ways to start. All bridge into the paid Premium catalog when you're ready.
Not ready to commit? The crash course is email-only. No academy account required.
Ready to Get Started?
Start this hands-on lab and build real-world Platform Engineering skills
Get Access Now