Changing routes in your VPC
With our VPCs and subnets created programmatically, we can now think about routing and, more specifically, how we want to route from a subnet to different destinations. AWS uses the concept of routing tables and routes, all of which can be configured programmatically. In this recipe, we are going to create a new VPC, associate a subnet with it, define an internet gateway for that subnet, and then change the routing table of our VPC and subnet so that it uses the previously created gateway.
Getting ready
Open your code editor and start by creating a file called create_routes.py
. Next, navigate your terminal to the same directory that you just created the create_routes.py
file in.
You'll have to have the same authentication that you set up in the Setting up the library to interact with your AWS account recipe.
How to do it…
Follow these steps to create a new route in your VPC:
- Import the
boto3
library:import boto3
- Let...