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
- 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
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
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.