Integration of task-1 using EFS instead of EBS using Terraform
- In this article I am integrating my task1 with EFS.
Task 1 Link :
About EFS : -
- Amazon Elastic File System (Amazon EFS) provides a simple, scalable, fully managed elastic NFS file system for use with AWS Cloud services and on-premises resources. It is built to scale on demand to petabytes without disrupting applications, growing and shrinking automatically as you add and remove files, eliminating the need to provision and manage capacity to accommodate growth.
- Amazon EFS is designed to provide massively parallel shared access to thousands of Amazon EC2 instances, enabling your applications to achieve high levels of aggregate throughput and IOPS with consistent low latencies.
- Amazon EFS is well suited to support a broad spectrum of use cases from home directories to business-critical applications. Customers can use EFS to lift-and-shift existing enterprise applications to the AWS Cloud. Other use cases include: big data analytics, web serving and content management, application development and testing, media and entertainment workflows, database backups, and container storage.
About Terraform :-
- It is a tool that has the capability to handle the multi-cloud setup. It is a standardized tool, i.e. we have to write the code in one language only, but it will be automatically used to interact with multiple clouds (technically known as Terraform Providers).
- Terraform works on declarative language, i.e. we just have to tell it what has to be done, it will automatically look into the situation & do that thing for us.
- Terraform is intelligent because of the plugins for each of the providers it has, using them as API, it can interact with any of its providers.
- Create EC2-key pair.
- Create EFS and attached this EFS to all region.
- Create security group that will allow ssh, nfs and http.
- Launch EC2 instance with nfs mount, install httpd sever and clone the git repository on document root.
- Creation of key-pair.
Step 2 :-
- Creation of Security-groups.
Step 3 :-
- Creation of EFS and attaching it to all availability zones.
Step 4 :-
- Launching EC2 instance with nfs mount.
Step 5 :-
- Run the above given code using terraform as
terraform apply -auto-approve
- After the successfull run of terraform command, you can verify it on aws portal.
- We can also verify it by accessing our website .
Step 6 :-
- Now,we can destroy the whole infrastructure by using one single command as
terraform destroy -auto-approve