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.
- Create the key and security group which allow the port 80.
- Launch EC2 instance.
- In this Ec2 instance use the key and security group which we have created in step 1.
- Launch one Volume (EBS) and mount that volume into /var/www/html
- Developer have uploded the code into github repo also the repo has some images.
- Copy the github repo code into /var/www/html
- Create S3 bucket, and copy/deploy the images from github repo into the s3 bucket and change the permission to public readable.
- Create a Cloudfront using s3 bucket(which contains images) and use the Cloudfront URL to update in code in /var/www/html
- 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.
Contribute to adyraj/aws_terraform development by creating an account on GitHub.
Contribute to adyraj/task_image development by creating an account on GitHub.