How to Deploy an HTTPD Server on AWS using Terraform

Cloud Automation

This project is made to display the Cloud Automation tools available and how to use them to have a online Website up and running in no time in AWS cloud using Terraform(to do IAAC) and get the public IP of same. We can also delete the whole setup in single command also. Here I have shown how to use Terraform to show the benefits of Infrastructure as a Code(IAAC) and make depolyment of whole setup smooth and easy.

Application and Services used:

Public CLoud :

AWS

awslogo-image.webp

Amazon Web Services, Inc. (AWS) is a subsidiary of Amazon providing on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis. These cloud computing web services provide a variety of basic abstract technical infrastructure and distributed computing building blocks and tools. One of these services is Amazon Elastic Compute Cloud (EC2), which allows users to have at their disposal a virtual cluster of computers, available all the time, through the Internet. AWS's virtual computers emulate most of the attributes of a real computer, including hardware central processing units (CPUs) and graphics processing units (GPUs) for processing; local/RAM memory; hard-disk/SSD storage; a choice of operating systems; networking; and pre-loaded application software such as web servers, databases, and customer relationship management (CRM).

To demonstrate Infrastructure as a Code:

Terraform

image

Terraform is an open-source infrastructure as code software tool created by HashiCorp. Users define and provide data center infrastructure using a declarative configuration language known as HashiCorp Configuration Language, or optionally JSON.

Hardware:

EC2 Instance

AWS_Simple_Icons_Compute_Amazon_EC2_Instances.svg.png

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.

For Backup:

EBS (Elastic Block Storage)

AWS_Simple_Icons_Storage_Amazon_EBS.svg.png

An Amazon EBS volume is a durable, block-level storage device that you can attach to your instances. After you attach a volume to an instance, you can use it as you would use a physical hard drive. EBS volumes are flexible. For current-generation volumes attached to current-generation instance types, you can dynamically increase size, modify the provisioned IOPS capacity, and change volume type on live production volumes.

For Web Hosting:

Apache HTTP server

kisspng-logo-apache-http-server-apache-software-foundation-apache-performance-tuning-sysinfo-io-5b7c0e12385ba7.9035614115348567222309.png

The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards. The Apache HTTP Server is a project of The Apache Software Foundation

STEP BY STEP GUIDE OF PROJECT

STEP 1. LAUNCH EC2 INSTANCE ON AWS

image

STEP 2. SET UP A EBS AS A BACKUP

image

STEP 4. MOUNTING EBS as backup to /var/www/html/

image

STEP 5.SET THE INBOUND TRAFFIC FOR SECURITY GROUP in AWS

image

STEP 6. EXECUTING REMOTE COMMAND TO AWS EC2 INSTANCES TO INSTALL:

HTTPD APACHE SERVER GIT PHP image

STEP 7. Copying data from github to /var/www/html/

image

STEP 8. COPYING PUBLIC IP IN TEXT DOUMENT

image image

STEP 9. Opening website in local browser

image image

To end all setup in 1 command

image image

What I learned from this project

This project has taught me what is Infrastruture as a code and how to deploy it on Terraform. It automates the workflow with minimal manual supervision and also destroying the whole setup is also easy with 1 command only.It was a great learning experience from the difficulties faced during the making of this project.