Using Terraform Provisioners to Set up an Apache Web Server on AWS

45 minutes
  • 3 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we’ll be using a Terraform provisioner to custom bootstrap a VM in AWS and install a webserver on it, and then test that the webserver is working as expected.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Clone Terraform Code and Switch to the Proper Directory
  1. Clone the code required for the lab from the provided GitHub repository.
  2. Switch to the appropriate directory where the code required for this lab resides.
Examine the Code in the main.tf File
  1. Examine the code in the resource block that is creating the EC2 instance (your virtual machine).
  2. Examine the code in the provisioner block that is issuing commands to be carried out on that resource once it is created.
Deploy the Code and Access the Bootstrapped Webserver
  1. Initialize the working directory and download the required providers with the terraform init command.
  2. Validate the code using the terraform validate command.
  3. Review the actions that will be performed when you deploy the code using the terraform plan command.
  4. Deploy the code with the terraform apply command.
  5. Navigate to the bootstrapped webserver’s IP address and validate that the provisioner worked as intended.

Additional Resources

Link to the GitHub repository for this lab:

https://github.com/linuxacademy/content-hashicorp-certified-terraform-associate-foundations.git

To get started, log in to the lab server using the credentials provided:

ssh cloud_user@<PublicIP>

Note: The lab server already has the permissions required to deploy infrastructure within AWS using the provided code that includes Terraform provisioners.

And, in a web browser, log in to the AWS Management Console using the credentials provided.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!