Deploy Infrastructure(website) On AWS and integrating with EFS(storage) using Terraform
!! Hello Connections !!
Welcome you all to my new article based on TASK 2 of Hybrid Multi Cloud Computing .
As TASK 2 is just upgraded version of TASK 1 purely based on terraform coding for creating Infrastructure As A Code .
The update in TASK2 is about storage we provide to our infrastructure . In this task we use EFS ( Elastic File Storage ) instead of EBS volumes .
TASK DESCRIPTION : Perform the Task-1 using EFS instead of EBS service on the AWS as, Create/launch Application using Terraform .
Agenda of the TASK :
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 .
TASK COMPLETION PROCESS:
1)Create key-pair and security group (allowing port no 80)for EC2 instance.
.2)Then creating and launching EC2 instance with key-pair and security group that created in step 1 and connect to instance by using remote login in terraform.
3)Now, the main step is to create Elastic File System (EFS) for storage . Using Elastic File System we can edit our content stored in it which is not provided by S3 and EBS volumes . After creating Elastic File System for our instance we have to mount it in our VPC .These EFS can be accessible from anywhere in the VPC not like EBS which requires to be in same data center where instance is running .
4)After successful mounting of EFS , we have to launch our instance for web application .Developer have uploaded the code for web application in github ,we have to clone the code from git hub repo into folder called /var/www/html . Before these all httpd services for apache web server should be installed in the instance .
5)Creating S3 bucket and cloudfront which access the object of S3 bucket.
6)creating bucket object and deploy images from git repo.
7) To access the bucket object as image we have to create one cloud front using S3 which will work as Content Delivery Netowk . Using , the URL provided by cloud front we can update our code .
8) Finally ,the whole infrastructure is ready . We can now access website application using , public ip of web server instance . You can also automate these part using echo command in local provisioner .
Finally all the completion process of the task is done through writing code in terraform without going manually everything is automated
Thanking you all for visiting my blog.
!!!A big thanks to VIMAL sir for giving such amazing task!!!
Great work 👍
Finally you did it 🙌