Infrastructure setup of Amazon EFS,EC2,S3 & Cloudfront using Terraform
Task Description
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.
Tools we are going to use
- AWS CLI
The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.
- Terraform
Terraform is an open-source infrastructure as code, software tool created by HashiCorp. It enables users to define and provision data center infrastructure using a declarative configuration language known as HashiCorp Configuration Language, or optionally JSON.
What is 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. It uses NFS protocol behind the scene.
NFS stands for network file system , it is easily mount to the multiple OS over the network and if developer change any code in this storage , all the OS can easily access the update code.
LETS'S START THE TASK :-
I will be creating the whole networking setup in AWS.
To know more about the networking part in AWS , Below I shared my 2 blog on VPC networking & Concepts of Internet gateways :
Configure The Provider
The Amazon Web Services (AWS) provider is used to interact with the many resources supported by AWS. Here we provide credentials to aws so that we as a user can go inside the aws and run our services
RUNNING FINE.
Finally to destroy the whole archiectecture we use " terraform destroy" command.
Application architect @ Tech Mahindra | CKA, Terraform CHIP, AWS, Azure, Python, Jenkins, Ansible, Kafka, ELK, Observability, TCP/IP Stack
4yHow can i be part of this learning journey. Could you please help me
Founder of Tuetotechni Web Design & Digital Marketing Consultant
4yCongratulations Brother