LAUNCH AN APPLICATION ON AWS

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

Task Description :

1. Create Security group which allow the port 80.

2. Launch EC2 instance.

3. In this Ec2 instance use the existing key or provided key and security group which we have created in step 1.

4. Launch one Volume using the EFS service and attach it in your vpc, then 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 :

2. Create the key pair.

3. Create VPC, Subnet and Internet Gateway.

4. Create Route Table.

5. Creating Security Group.

6. Launch EC2 Instance.

7. Create EFS Volume.

8. Mount the EFS to /var/www/html.

9. Created a S3 bucket and with permission to public and their downloaded the image from github.

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

11. 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.

VPC, Subnet and Internet Gateway :

Route Table :

Security Group :

EC2 Instance :

S3 Bucket :

Cloudfront :

Thank You!!