Launching An Application using Terraform (through EFS)

Launching An Application using Terraform (through EFS)

- Create Security group which allow the port 80.

- Launch EC2 instance.

- In this EC2 instance use existing key or provided key and security group .

- Launch one Volume using the EFS service and attach it in your vpc, then mount that volume into /var/www/html.

- Developer have uploaded 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.

STEP1: Login with CLI then use aws configure command and give the access key, secret key from credential file and region name.

STEP2: Create a directory and then create a file inside it with “.tf” extension.

STEP3: Give the name of the provider(AWS) to whom the Terraform will contact.

STEP 4: Creating Security group with allowing Port 80 For http and Port 22 For ssh.

STEP 5: Launch EC2 instances

No alt text provided for this image

STEP 6: Launch one Volume using the EFS service and attach it in your vpc, then mount that volume into /var/www/html

No alt text provided for this image

STEP 7: Create S3 bucket, and copy deploy the images from github repo into the s3 bucket and change the permission to public readable

No alt text provided for this image

STEP 8: Create VPC ,Subnet ,Internet gateways, Routing tables

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image


No alt text provided for this image

STEP 8. Create a Cloudfront using s3 bucket(which contains images) and use the Cloudfront URL to update in code in /var/www/html

No alt text provided for this image

Now, use the following commands to initialize and run the code.

No alt text provided for this image
No alt text provided for this image

Finally go to browser : https://52.66.244.80

?

No alt text provided for this image

We had successfully Launch Application using Terraform

Github link for the terraform code: https://github.com/apurvwagh/Terrainfra_code.git

Thanks for reading...


要查看或添加评论,请登录

Apurv Waghmare的更多文章

社区洞察

其他会员也浏览了