Cloud Computing / AWS

Automated Infrastructure with AWS and Terraform

Main Logo

Cloud Computing Technologies has been there in the market for a long time. Since the launch of Public Clouds like Amazon Web Services (AWS) in 2006 and Microsoft Azure in 2008, many small, as well as large firms we know today, have outsourced their infrastructure to focus on their R&D and Business plans.

Thus an era of providing infrastructure as a Service (IAAS) started. Then came other big players like Openstack, providing Private cloud infrastructure. At last, we have Google entering the market with Google Cloud Services(GCP). The revenue generated by renting the hardware equipment to companies through affordable plans to run their business proved to be highly profitable to all the players.

Why AWS still Dominates the Cloud Market?

AWS has become a crucial part of any development process. The services it allows fastens the process of development through numerous automation techniques. All the functionalities can be accessed from the Website, which is targeted to the masses as well as Command-line Interface(CLI) for developers and operators.

In today’s scenario, we see AWS is one of the most dominant players in cloud computing, due to the following reasons:

  • It Has Been Around the Longest
  • You Get A Year To Test It Out For Free
  • It Is So Much Bigger Than Its Competitors

Moving towards Multi-Cloud Architecture

In recent times, things have changed a lot. Cloud computing has become a more advantageous and effective way for Start-ups as they can now focus on the business rather than worrying about the hardware infrastructure.

Due to the arrival of several IAAS providers, companies have moved towards a Multi Hybrid Cloud Architecture where different services are rented from different cloud providers. This has resulted in stiff competition among the players regarding the pricing.

But when it comes to handling different cloud platforms simultaneously for single projects, it becomes a challenging task since each has its set of instructions. Moreover, the infrastructure set up at a point on the cloud should be developed in such a way that changes and portability among clouds should not be a problem.

These problems can be solved by developing Infrastructure-as-a-Code for Cloud Automation with Terraform.

Introduction to Terraform

Terraform is the infrastructure as code offering from Hashi Corp. It is a tool for building, changing and managing infrastructure in a safe, repeatable way. Operators and Infrastructure teams can use Terraform to manage environments with a configuration language called the HashiCorp Configuration Language (HCL) for human-readable, automated deployments.

Getting Started

We are going to automate and create an IAAC with the help of Terraform and AWS. Terraform plugins allow users to use any of the approved cloud technologies it supports. Thus by installing the AWS plugin with Terraform, we can write the code which can set up the Infrastructure in AWS automatically.

The workflow of the Process

  1. Creating a key and security group which will allow port 80, thus allowing users to connect to the hosted website.
  2. Launching an AWS EC2 instance and using the key and Security group created earlier.
  3. Launching one Volume (EBS) and mounting it into /var/www/html
  4. Copying the Github repository code into /var/www/html
  5. Creating an AWS S3 bucket and deploying the images from GitHub repository 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 in /var/www/html.

--

--

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