attach route table aws

Create Routing Table On Cloud Using CLI On Windows

We can create routing tables and routing rules in AWS using CLI as well as attach route tables. In a similar way, we can have a route table in our VPC network AWS, and Let’s see, how to make and create a routing table. so

We have already created VPC and subnets. If you don’t know about it, you can check here how to create VPC and Subnets. so

Now create a route Table using CLI.

C:\Users\pankaj>aws ec2 create-route-table –vpc-id vpc-0458a0c7f45566cc4

Now we haven’t assigned a name to our route table. So, we need to run the below command. You can find the route table id as shown in the above figure “RouteTableId”: “rtb-07068a9a0f0bfd990“.

C:\Users\pankaj>aws ec2 create-tags –tags Key=Name,Value=MyRoute –resources rtb-07068a9a0f0bfd990

Check Out: Install New Microsoft Edge Browser Based on Chromium On Windows

Verify on AWS Cloud

As you can see tag has assigned to a routing table. 

An associate routing table with subnets:

The next step is to associate the routing table to subnets using the below command.

C:\Users\pankaj>aws ec2 associate-route-table –route-table-id rtb-07068a9a0f0bfd990 –subnet-id subnet-0e990d337f526a200

aws routing between subnets

Check Out:  How To Fix the Upload Max File Size Issue In PHP File On WordPress

You will see a default route with that’s automatically created by AWS.

We can also check whether it’s associated or not with the routing table.

route table create using cli aws

If you require to attach the Internet gateway to the routing table. You have to create an internet gateway using the below command.

C:\Users\pankaj>aws ec2 create-internet-gateway

routing table aws

Once it’s created, we have to attach it to the VPC network.

C:\Users\pankaj>aws ec2 attach-internet-gateway –vpc-id vpc-0458a0c7f45566cc4 –internet-gateway-id igw-02dcdf4f0d2de9e84

Then we can attach it to the routing table with the below commands. If you see the output like this means you have attached it to the routing table. We have to add network to subnet route tables because if you want to allow your subnets to access the internet So it will go out through the IGW.

Check Out: Docker Swarm Error response from daemon: rpc error: code

C:\Users\pankaj>aws ec2 create-route –route-table-id rtb-07068a9a0f0bfd990 –destination-cidr-block –gateway-id igw-02dcdf4f0d2de9e84

 route table create aws

Now we will verify on AWS routing tables.

aws routing rules

You’re done Aws routing rules attach route table aws


Please enter your comment!
Please enter your name here