LAUNCH AN APPLICATION ON AWS USING TERRAFORM

This task is about launching an application on AWS using services like EC2, EBS, S3 and Cloudfront with the help of terraform.

Task Description:-

  1. Create the key and security group which allow the port 80.
  2. Launch EC2 instance.
  3. In this Ec2 instance use the key and security group which we have created in step 1.
  4. Launch one Volume (EBS) and mount that volume into /var/www/html
  5. Developer have uploded the code into github repo also the repo has some images.
  6. Copy the github repo code into /var/www/html
  7. Create S3 bucket, and copy/deploy the images from github repo into the s3 bucket and change the permission to public readable.
  8. Create a Cloudfront using s3 bucket(which contains images) and use the Cloudfront URL to update in code in /var/www/html

Terraform Code:-

  1. Here we are using aws as provider so we need to setup region and profile.

2. Create the key pair.

3. Create the Security Group which allow the port 80.

4. Launch EC2 instance by using the key and security key created.

5. EBS volume with size 1GB.

6. After creating the EBS volume now we need to mount it with the instance and then download the code from the github into the folder /var/www/html

7. Now I have created a S3 bucket and with permission to public and their i have downloaded the image from github.

8. Created a Cloudfront using s3 bucket and then I use the Cloudfront URL to update in code in /var/www/html

9. Here I had printed the IP of the instance and also launched the application using chrome after the whole setup is ready.

Now I just need to run the terraform command to run the code.

terraform apply -auto-approve

Here is the final output of my code.

Here is my website launched on aws using terraform.

Here is the github link of my code.

Thank you!

--

--

--

I'm passionate learner diving into the concepts of computing 💻

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CS373 Spring 2022: Matthew Kozlowski — Week 12

Exploring the universe at highest energies, software processes, and team leadership

Introduction to Programming with Python

Binary exploitation Pwnable.kr (Level 1) FD

Devs have eaten the world

Learning How to Code, One Step at a Time

Resolution of Critical vulnerability in log4j2 for CDH, HDP, HDF, and CDP

The static Library:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditya Raj

Aditya Raj

I'm passionate learner diving into the concepts of computing 💻

More from Medium

How to Create an EC2 Instance with an Apache Server using the AWS CLI

Follow Me While I Create An EC2 Instance with Apache webserver!

Docker Introduction: Hands-on With Docker — Part 2

Setting up Jenkins on AWS EC2