Automating AWS Infrastructure with Terraform
Tags: aws, terraform, devops, github
Published: 2022-08-30 16:30:41

**What is Cloud Automation and Why is it Important in IT?**

Cloud automation broadly refers to the processes and tools used to provision and manage cloud computing workloads and infrastructure. These processes and tools aim to reduce or eliminate manual processes, saving costs and resources.

With the increasing demand of serving a wider group of customers/clients and expanding the customer base, organizations need to consider the adoption of **Cloud Automation** as it affords them the ability to scale efficiently. Several IT companies have adopted cloud automation to optimize their business resources while also staying on top of their games.
Some of the reasons why companies will want to consider the adoption of cloud adoption are listed below

1. It saves an IT team time and money;
2. It is faster, more secure and more scalable than manually performing tasks;
3. It leads to fewer errors, as organizations can construct more predictable and reliable workflows; and
4. It contributes directly to better IT and corporate governance.

Next, we shall explore cloud automation tools which are categorized as:
**Cloud Providers (private and public):** These include:-

i. **AWS**: AWS Config, AWS CloudFormation, AWS EC2 Systems Manager;
ii. **Azure**: Microsoft Azure Resource Manager, Azure Automation;
iii. **Google**: Google Cloud Composer, Cloud Deployment Manager; and
iv. **IBM**: IBM Cloud Orchestrator.

2. **Configuration Management tools**: Most of these tools allows for Infrastructure-as-a-service (IaaS) setup, and has the below as some of its examples:

i. Red Hat Ansible,
ii. Puppet Enterprise,
iii. Chef Automate,
iv. Salt/SaltStack, and
v. HashiCorp Terraform

Many multi-cloud management vendors incorporate automation capabilities into their tools. Some prominent ones are:

i. VMware,
ii. CloudBolt,
iii. CloudSphere (Hypergrid),
iv. Snow (Embotics),
v. Morpheus Data,
vi. Scalr, and
vii. Flexera (RightScale).

To read more about cloud automation, click [here](https://www.techtarget.com/searchcloudcomputing/definition/cloud-automation#:~:text=Cloud%20automation%20is%20a%20broad,public%20and%20hybrid%20cloud%20environments).

Having introduced us to the basics of cloud automation, its importance, and tools used for cloud automation. We shall employ some of the earlier mentioned cloud automation tools to build a project. We will use AWS, HashiCorp Terraform, and Microsoft Visual Studio Code (VSC) as our IDE.

This project introduces beginners to Cloud Infrastructure Automation, with AWS as the cloud provider. A detailed explanation of the processes and resources created in this small project can be found [here](https://github.com/Behordeun/Automating-AWS-Infrastructure-with-Terraform). Simply follow the guides [here](https://github.com/Behordeun/Automating-AWS-Infrastructure-with-Terraform/blob/main/README.md), and you should be fine. Feel free to fork this repo, raise a pull request to contribute to this project, and raise an issue if you encounter any challenges

![A workflow of resources deployed via terraform](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t4orajel386nozzws039.png)

This project created nine resources/processes in our AWS instance right from terraform. These resources are:

1. **Virtual Private Cloud (VPC)**: A virtual private cloud (VPC) is a secure, isolated private cloud hosted within a public cloud. VPCs combines the scalability and convenience of public cloud computing with private cloud computing data isolation. Click here to read more about VPC.

2. **Internet Gateway**: An Internet gateway is a network "node" connecting two networks that use different protocols (rules) to communicate. In the most basic terms, an Internet gateway is where data stops on its way to or from other networks. [Click here to read more about internet gateway](https://www.cloudflare.com/learning/cloud/what-is-a-virtual-private-cloud/).

3. **Custom Route Table**: A route table contains a set of rules, called routes, that are used to determine where network traffic from your subnet or gateway is directed. In a more explicit term, a route table tells network packets which way they need to go to get to their destination. [Click here to read more about custom route table.](https://www.whatismypublicip.com/blog/what-is-an-internet-gateway/)

4. Subnet: A subnet, or subnetwork, is a segmented piece of a more extensive network. More specifically, subnets are a logical partition of an IP network into multiple, smaller network segments. [Click here to read more about subnets.](https://www.techtarget.com/searchnetworking/definition/subnet)

5. We associated the subnet created in step 4 with the route table created in step 3.

6. We created a Security Group to allow ports 22, 80, 443.

7. Create a network interface with an IP in the subnet created in step 4.

8. Assigned an elastic IP to the network interface created in step 7

9. Created an Ubuntu server and installed/enabled apache2

Remember to drop a comment and drop a like if you have benefitted from this article.

You can connect with me via:
Email: [abiodun.msulaiman@gmail.com](mailto:abiodun.msulaiman@gmail.com) or
LinkedIn: [Muhammad Abiodun Sulaiman](https://www.linkedin.com/in/muhammad-abiodun-sulaiman)