Recall & Review
beginner
What is an AMI in AWS?
An AMI (Amazon Machine Image) is a template that contains the software configuration (operating system, application server, and applications) required to launch an EC2 instance.
Click to reveal answer
beginner
What does the Terraform 'data' block do when looking up an AMI?
The 'data' block in Terraform fetches information from existing resources, like finding the latest AMI ID based on filters, without creating new resources.
Click to reveal answer
intermediate
Why use filters in an AMI lookup data source?
Filters help narrow down the search to find the exact AMI you want, such as by name, owner, or tags, ensuring you get the right image for your EC2 instance.
Click to reveal answer
intermediate
Example: What does the attribute 'most_recent = true' do in an AMI lookup?
It tells Terraform to select the newest AMI that matches the filters, so you always get the latest version available.
Click to reveal answer
beginner
How do you reference the AMI ID found by the data source in Terraform?
You use the syntax: data.<data_source_name>.<resource_name>.id to get the AMI ID for use in other resources like EC2 instances.
Click to reveal answer
In Terraform, which block is used to look up an existing AMI?
✗ Incorrect
The 'data' block is used to fetch existing information like AMI details without creating new resources.
What does setting 'owners = ["amazon"]' do in an AMI lookup?
✗ Incorrect
It filters the AMIs to only those owned by Amazon.
Which attribute ensures Terraform picks the latest AMI matching filters?
✗ Incorrect
'most_recent = true' tells Terraform to select the newest AMI.
How do you use the AMI ID found by the data source in an EC2 resource?
✗ Incorrect
You reference the AMI ID using the data source name and resource name.
What is the purpose of the 'filter' block inside the AMI data source?
✗ Incorrect
Filters help find the AMI that matches specific criteria.
Explain how to use Terraform to find the latest Amazon Linux 2 AMI using a data source.
Think about filters, owner, and most_recent attributes.
You got /5 concepts.
Describe why using an AMI lookup data source is better than hardcoding an AMI ID in Terraform.
Consider what happens when AMIs get updated.
You got /5 concepts.