My First Terraform Code:

Aditisinha
3 min readJun 12, 2020

Hey Everyone!!

Let me first introduce you to Multi cloud. Nowadays, the corporate world is shifting towards Multi cloud, where you do not rely on the services of just any one cloud provider , you avail services from multiple cloud platforms due to obvious reasons like cost , availability, etc.

And to interact to any cloud service provider you got a standardization through Terraform. One of its key feature is Infrastructure as Code which is very helpful in deploying services in Multiple cloud providers. And this way, you save your ample amount of time by not learning the code for each provider. Imagine a situation where to use a cloud provider service you need to learn its code , keywords, syntax , etc. Such a tedious job ..lol!!!

Lets go to the code — —

(Cloud Service Provider: AWS)

  1. Creating the key and security group which allow the port 80.

2. Launch EC2 instance. Using the created security group and key.

3. Launch one Volume (EBS) and attaching it to the instance we created.

4. Mounting that volume to /var/www/html, some code is uploded at github repo . Copying the github repo code into /var/www/html

5. Create S3 bucket, and copy/deploy the images from github repo into the s3 bucket and changing the permission to public readable.

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

Now, we have the cloudfront URL that is updated in my code at github repository, and you have a fully automated infrastructure code…run it and get started.

And this is my website I created using above infrastructure:

(I know ..not at all cool!)

--

--

Aditisinha
0 Followers

B. Tech 3rd Year student. Keen interest in knowing new technologies and spend most of the time in learning them.