Step-By-Step Process To Create To Create AWS Route table Using Terraform

Here, i am going to create a aws Route table by launching AWS ec2 instance.

Step 1: Setting Up AWS account

  • Go to AWS Management Console
  • Login by using with your credentials.
  • Now you need to generate access key to authenticate Terraform with your AWS account
  • In AWS management console in home screen search for IAM ( Identity and Access Management ) service. Choose Users and click on Add user.
  • Give a username and select administration access as the access type. Attach necessary permissions to the user.
  • Review the user details and create the user. Now you will see the access key ID and secret access key. Save this information securely as it will be required when configure Terraform.

Step 2: Launch EC2 instance And Install Terraform

configuration ofge – 8gb with root volume type gp2

connect this instance with any CLI terminal by using SSH

ssh -i  "pemfile" ec2-user@<instance-public-ip address>compute-1.amazonaws.com

connecting ec2 instance

  • Now install terraform by using following commands

Make sure we have to install terraform in our ec2 instance

  • For this we need to download terraform hashicorp related packages and repo.
  • I take these keys and repo from terraform official page.
  • https://developer.hashicorp.com/terraform/install#linux
  • to install terraform in our OS follow the below commands.
sudo yum install -y yum-utils shadow-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
sudo yum -y install terraform

Terraform installation setup

Step 3: Set Up AWS Credentials

  • Configure your AWS credentials either through environment variables, the AWS CLI, or a shared credentials file. This allows Terraform to authenticate with your AWS account.
aws configure

aws configuration

How To Create Route Table In AWS Using Terraform ?

Terraform is a popular IAAC (Infrastructure as a Code) tool used in automation to create, manage, modify, update, and destroy any cloud resources and cloud environment. Terraform supports any cloud provider, including AWS, Microsoft Azure, GCP, Oracle, Alibaba, IBM, Salesforce, etc.

Here, in this guide, I am going to discuss the AWS Route Table first, and I will discuss deeply what Terraform is. After that, I will walk you through different steps to write a Terraform script and execute the scripts. By using these Terraform scripts, we can create our custom route table and associate this route table with the AWS subnet.

Similar Reads

Understanding Of Primary Terminologies

What is the AWS Route Table?...

What is Terraform?

Terraform is an Infrastructure as Code (IaC) tool that allows users to define and provision infrastructure resources in a declarative manner using Hashicorp language, also called HCL (Hashicorp Configure Language).When working with AWS, Terraform enables you to create, manage, and update resources such as EC2 instances, Security groups, VPCs, route tables, internet gateways (IGW), S3 buckets, and relational databases efficiently and consistently....

Terraform has two types of flows

Workflow: In workflow we have three stages, first one is write the terraform code for what cloud resources we want and second one is plan it gives a blueprint of cloud resources which we desired to create and finally third one is apply it simply starts building the terraform code....

Step-By-Step Process To Create To Create AWS Route table Using Terraform

Here, i am going to create a aws Route table by launching AWS ec2 instance....

Terraform Scripts

In Terraform, the terraform block is used to configure settings related to the Terraform execution environment itself. This block allows you to define various options and configurations that affect how Terraform behaves when executing your infrastructure code....

Provider Block

In Terraform, the “provider” block is a fundamental construct used to define and configure the provider responsible for managing the resources in a specific cloud or infrastructure environment. Providers are plugins in Terraform that interface with APIs of various services or platforms to create, read, update, and delete resources....

Resources Block

In Terraform, the “resources” block is not a specific construct like the provider or terraform blocks. Instead, it’s a common terminology used to refer to the section of a Terraform configuration where you define the infrastructure resources what you want to desire....

Route table in aws using terraform – FAQ’s

What is a Route Table in AWS?...