Launch Application On AWS With EFS Using Terraform-

Launch Application On AWS With EFS Using Terraform-

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.

Amazon Elastic File System (EFS) provides scalable file storage for use with Amazon EC2. We can create an EFS file system and configure our instances to mount the file system. We can use an EFS file system as a common data source for workloads and applications running on multiple instances.

Task : Create/Launch Application using Terraform-

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

Follow these steps:-

Step1 - In the very first step, we have to create a Key-Pair using terraform code.

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 2 - After that we have to create a security group for launcing EC2 instance by using terraform code.

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 3 - We have to launch an EC2 instance using the key-pair and security group created by us in the previous steps.

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 4 - We have to launch volume by using EFS and then we have to mount it into /var/www/html.

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
No alt text provided for this image

Step 5 -  Here, we have to create an S3 bucket and upload the images from Github repository to the S3 bucket using terraform code and make it public readable.

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
No alt text provided for this image

Step 6 - Now, 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
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Step 7 - Now when we type the cloudfront url followed by the image url then we will see something like -

No alt text provided for this image

Step 8- Now launch the website using the below code:-

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

Step 9 - Destroy the complete environment using the command-

No alt text provided for this image


Thanks for giving your valuable time in reading the article!!


For the full code, go to my Github Repo using the link given below -https://github.com/Megha-Varshney/AWS_EFS/blob/master/file1

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

Megha Varshney的更多文章

  • Multi Node Kubernetes Cluster Using Ansible..

    Multi Node Kubernetes Cluster Using Ansible..

    What is a Kubernetes Cluster? A Kubernetes Cluster is a set of nodes that run containerized applications. Kubernetes…

    4 条评论
  • How to Configure Web Server Inside the Docker Container by Retrieving Container's IP Dynamically Using Ansible Playbook?

    How to Configure Web Server Inside the Docker Container by Retrieving Container's IP Dynamically Using Ansible Playbook?

    Task Description ??:- ??Create an Ansible playbook that will retrieve new Container IP and update the inventory. So…

  • GUI Applications On The Top Of DOCKER

    GUI Applications On The Top Of DOCKER

    What is Docker? Docker is an open source project that makes it easy to create containers and container-based apps. With…

  • Integration of WordPress with Amazon RDS:-

    Integration of WordPress with Amazon RDS:-

    What is AWS ? Amazon Web Services (AWS) is a secure cloud services platform, offering compute power, database storage…

  • What is Jenkins and How Netflix uses it?

    What is Jenkins and How Netflix uses it?

    Hello guys, In this blog I’m going to explain the automation using Jenkins and a case study on Netflix. But before…

  • OpenShift and It's UseCases

    OpenShift and It's UseCases

    What is OpenShift ? OpenShift is a cloud development Platform as a Service (PaaS) developed by Red Hat. It’s an open…

  • Simple Queue Service by AWS

    Simple Queue Service by AWS

    What is SQS? SQS stands for Simple Queue Service. SQS is a managed message queue service offered by Amazon Web Services…

  • Neural Networks

    Neural Networks

    Neural Networks A Neural Network is a processing device, either an algorithm whose design is inspired by the design and…

  • Azure Kubernetes Service

    Azure Kubernetes Service

    What is Azure Kubernetes Service? AKS stands for Azure Kubernetes Service provided by Azure Cloud. It is an open-source…

  • KUBERNETES USE CASES - AIRBNB And PINTEREST

    KUBERNETES USE CASES - AIRBNB And PINTEREST

    What is Kubernetes? KUBERNETES is a container management system developed in the Google platform. Kubernetes is the…

    2 条评论

社区洞察

其他会员也浏览了