This project focuses on deploying an Apache Web Server in the AWS cloud using Terraform Infrastructure as Code (IaC) tool. The goal is to automate the process of creating necessary resources, configure and deploy the Apache Web Server in a Virtual Private Cloud (VPC) network. The project utilizes various AWS services such as S3, DynamoDB, IAM, VPC, Auto Scaling Group, Load Balancer, CloudWatch and others to achieve the desired outcome.



  • Created an S3 Bucket to store the Terraform state files and another S3 Bucket to store the Apache webserver configuration and index.html file.
  • Created a DynamoDB to support Terraform state locking.
  • Deployed a VPC Network using Terraform IaC and stored the state files in the S3 backend.
  • Created an SNS topic for notifications.
  • Implemented an IAM role with the necessary permissions to access the S3 Buckets and Session Manager.
  • Created a Golden AMI to store the configuration of the Apache Web Server.
  • Wrote Terraform IaC to deploy the following resources in the VPC network:
    • IAM Role with permissions to PUT/GET from the S3 Bucket and Session Manager access.
    • Launch Configuration with a user-data script to pull the index.html file from the S3 Bucket and configure the Apache Web Server using an Ansible Playbook.
    • Auto Scaling Group with a minimum of 1, maximum of 1 and desired capacity of 1, deployed in a private subnet.
    • Target Group with health checks attached to the Auto Scaling Group.
    • Application Load Balancer deployed in a public subnet with a listener port configured to route traffic to the Target Group.
    • Alias record in the Hosted Zone to route traffic from the public network to the Load Balancer.
    • CloudWatch Alarms to send notifications when the Auto Scaling Group state changes.
    • Scaling Policies to scale out/in based on average CPU utilization exceeding 80%.
  • Deployed the Terraform IaC to create the necessary resources.
  • Validated the deployment by logging into the AWS Console and verifying all resources were deployed correctly.
  • Tested the web application by accessing it from a public internet browser using the domain name.
  • Destroyed the resources once the testing was completed to minimize the billing.


In conclusion, the Deploy Apache Web Server using Terraform IaC project was a comprehensive implementation of infrastructure as code using Terraform. The project demonstrated the ability to create and manage infrastructure resources in the AWS cloud using Terraform IaC. The goal of the project was to deploy an Apache Web Server in a virtual private cloud and make it accessible from the public internet. This was achieved by creating the necessary resources such as an S3 bucket, DynamoDB, VPC network, IAM role, launch configuration, auto-scaling group, target group, application load balancer, CloudWatch alarms, and scaling policies.


Technology / Services

  • Amazon S3
  • AWS EC2
  • ALB
  • AWS Route 53
  • Auto Scaling Group
  • IAM
  • Apache web server