CLIENT AREACall Us 1-800-383-5193


Call Us 1-800-383-5193


Call Us 1-800-383-5193

Need help?

Our experts have had an average response time of 13.52 minutes in October 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Add Routes to Main Route Table in VPC

by | Oct 20, 2021

We can use AWS CloudFormation to add routes to the main route table in VPC.

Here, at Bobcares, we assist our customers with several VPC queries as part of our AWS Support Services.

Today, let us see how our techs add the same.


Add Routes to Main Route Table in VPC

A main route table is created when we create a VPC using AWS CloudFormation. AWS CloudFormation fails to recognize this route table.

This means we cannot pass information about the routing table between the VPC and AWS CloudFormation.

Since we can’t reference the main route table from the AWS CloudFormation template we fail to add or remove routes from the main route table.

To resolve this, we use an AWS Lambda-backed custom resource in an AWS CloudFormation template.

This template will use a Lambda function to retrieve the main route table ID associated with the VPC.

Moving ahead, let us see the steps our Support Techs employ to perform the same.

1. Initially, we download the RouteTable.template and files from the AWS GitHub repository.

2. Then we create a zip file called for the Lambda function.

For example, like the following:


However, make sure that the location of the is at the root level of the zip file.

3. After that, we upload the zip file to an Amazon S3 bucket that’s in the same AWS Region as the AWS CloudFormation stack with the Amazon S3 console.

Now, we need to upload the zip file using the AWS CLI. To do so, from the folder we run:

aws s3 cp ./ s3://awsexamplebucket1/

4. Later, to launch the stack with the RouteTable.template file, we use the AWS CloudFormation console or run:

aws cloudformation create-stack --stack-name myvpcstack --template-body file://RouteTable.template --parameters ParameterKey=Bucket,ParameterValue=awsexamplebucket1 ParameterKey=Key, ParameterKey=Lambdahandler,ParameterValue=Routetable --capabilities CAPABILITY_NAMED_IAM --region us-east-1

Make sure to pass the name of the Amazon S3 bucket, the zip file name, and the name of the file where we created the Lambda function as parameters when we create or update the AWS CloudFormation stack.

[Need further assistance? We are here for you]



In short, we saw how our Support Techs add routes to main route tables.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.



Submit a Comment

Your email address will not be published. Required fields are marked *