34.1 C
Sunday, June 23, 2024

AWS Architecture Implementation using Terraform.

Terraform, an innovative Infrastructure as Code (IaC) tool, empowers organizations to efficiently create, manage, and scale their cloud infrastructure with remarkable agility and precision. By codifying infrastructure provisioning and configuration, Terraform enables the automation of complex deployment processes, resulting in reduced human error, increased consistency, and enhanced collaboration among development and operations teams.

Amazon Web Services (AWS), Terraform is a foundational pillar for implementing cloud architecture. Its declarative language allows developers to describe their desired infrastructure state in code, which Terraform interprets to create and manage AWS resources. The benefits are manifold:

Let’s Start creating an infrastructure for AWS in Terraform.

To connect your Terraform codes with the AWS platform, install the latest version of AWS CLI in your system.


Connect the Terraform code to the AWS platform using the following commands in Visual Studio Code.


Now, prepare the Terraform codes for the Architecture you want to implement in your AWS tenant.

In this case, I have created,

  • VPC network
  • Subnets
  • EC2 with external disks
  • Availability Zones
  • Security Groups and Tags.

Diagrammatic representation of the Infrastructure.

  • Git Hub Repo link –


Get inside the repo

Now uncommand this file main-aws-example and remove other main.tf files.

Needed Resources –

  • Terraform latest version is installed.
terraform -version 

The requested infrastructure has to be implemented to the AWS use the following commands to execute.

terraform init

Make sure you are running on the right subscription. If you have access to multiple subscriptions

terraform plan

Now terraform apply command is used to create the resources.

terraform apply

And once all the steps are done, the Infrastructure will be created in the AWS tenant id.


2. VPC

3. Subnets

4. Security Groups

The entire Infrastructure is created and managed through Terraform. We can make any alterations and follow the previous steps to apply them to your tenant.

Now terraform destroy command is used to clean up the resources.

terraform destroy
Santhosh M
Santhosh M
As a seasoned DevOps Engineer at Virtual Petals, I bring a wealth of expertise in Microsoft Cloud, DevOps, and the Microsoft 365 Stack. With a track record of delivering successful projects across the globe.

Related Articles


Please enter your comment!
Please enter your name here