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.

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!