Terraform with AWS(including EFS instead of EBS) Full Automation.

AWS

Amazon Web Services (AWS) is a subsidiary of Amazon that provides on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis. In aggregate, these cloud computing web services provide a set of primitive abstract technical infrastructure and distributed computing building blocks and tools. One of these services is Amazon Elastic Compute Cloud (EC2), which allows users to have at their disposal a virtual cluster of computers, available all the time, through the Internet.

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.

The main components involved in launching of a web server are:
1. Elastic Cloud Compute(EC2) is a part of Amazon’s cloudcomputing platform that allows users to rent virtual computers on which to run their own computer applications. It provides compute as a service to the users(CAAS).

2. Elastic File System(EFS) is a cloud storage service provided by (AWS) designed to provide scalable, elastic, concurrent with some restrictions and encrypted file storage for use with both AWS cloud
services and on-premises resources. In simple words, it provides File storage as a service(FSAAS).

3. CloudFront is a content delivery network (CDN) offered by Amazon Web Services . Content delivery networks provide a globallydistributed network of proxy servers which cache content, such as web videos or other bulky media, more locally to consumers, thus improving access speed for downloading the content.

Create/launch Application using Terraform

  1. Create the key-pair and security group which allow the port 80.

2. Launch an EC2 instance. In this EC2 instance use the key and security group which we have created in step 1.

3. Launch one storage volume (EFS) and attach that volume into the EC2 instance launched & mount the directory.

4. Get the code uploaded by the developer in GitHub and copy the code in the /var/www/html folder for deployment.

5. Create S3 bucket, and copy/deploy the static images into the S3 bucket and change the permission to public readable.

6 Create a CloudFront using S3 bucket(which contains images) and use the CloudFront URL to update in code.

7. Launch the application for testing from the code itself.

STEP1: Specifing Provider

STEP2: Creating Security Group

This is security group, we are defining a firewall which has allowed SSH, HTTP & one more port through which EFS can communicate, the inbound or the traffic coming in is called ingress and the out bound or traffic going outside is called egress. CIDR defines the range.

STEP3: Launching EFS

This is to create EFS, this will create EFS cluster with the encryption done on the data in rest.

STEP4: Launching instance(EC2)

This will create the instance with some listed software and will also mount the EFS which we created.

STEP5: Creating S3 bucket

This will help us create S3 bucket, this works as a unified storage from where we will use cloud front to make it globally scaled using its power of doing CDN- Content Delevery Network.

STEP6: Uploading on S3 bucket

Uplaoding the the static data to the s3 bucket that we just created. Key is the name of the file after the object is uploaded in the bucket and source is the path of the file to be uploaded.

STEP7: Creating CloudFront

CloudFront is the service that is provided by the AWS in which they create small data centres where they store our data to achieve low latency. It will create a CloudFront distribution using an S3 bucket. In this bucket, we have stored all of the assets of our site like images, icons, etc.

Terraform init

Terraform apply — auto-approve

Here my task is completed

Thank you…..

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store