VM::EC..._table(3pm)
β¨ NAME β¨
VM::EC2::REST::route_table β bestie, this is the VM::EC2 module that creates and manipulates VPC route tables. That's the whole vibe. π£οΈπ
π¦ SYNOPSIS π¦
use VM::EC2 ':vpc';
πΈ METHODS πΈ
These methods are literally your whole toolkit for creating and manipulating VPC route tables. No cap.
Implemented (the ones that actually exist, periodt):
AssociateRouteTableCreateRouteCreateRouteTableDeleteRouteDeleteRouteTableDescribeRouteTablesDisassociateRouteTableReplaceRouteReplaceRouteTableAssociation
Unimplemented:
(none)
Not a single one missing. The roster is complete. πβ¨
$table = $ec2->create_route_table($vpc_id)
$table = $ec2->create_route_table(-vpc_id=>$id)
This one makes a brand-new route table inside the VPC you hand it, and gives you back a VM::EC2::VPC::RouteTable object. Obsessed. π
By default, every route table comes with a local route that lets traffic flow around inside the VPC β that's just how it's born. Wanna add more routes? That's create_route()'s job.
You can call this with a single argument that is the VPC ID for your shiny new route table, or you can use the named argument form. Either one, your call, main character energy both ways.
Required arguments:
-vpc_idβ A VPC ID, or a previously-createdVM::EC2::VPCobject.
$success = $ec2->delete_route_table($route_table_id)
$success = $ec2->delete_route_table(-route_table_id=>$id)
Deletes the route table you point at, and every single route entry inside it. It's giving demolition. π
Heads up bestie, it may not be called on the main route table, and it may not be called if the route table is currently associated with a subnet. Those are hard nos.
Call it with one argument that's the route table's ID, or use the named form with the argument -route_table_id.
@tables = $ec2->describe_route_tables(@route_table_ids)
@tables = $ec2->describe_route_tables(\%filters)
@tables = $ec2->describe_route_tables(-route_table_id=> \@ids, -filter => \%filters);
Describes all β or some β of the route tables you've got available. You can filter to narrow it down to a particular type of route table using one of the filters described at:
Some of the filters everyone actually uses:
vpc-idβ ID of the VPC the route table is in.association.subnet-idβ ID of the subnet the route table is associated with.route.stateβ State of the route, either'active'or'blackhole'tag:<key>β Value of a tag
$associationId = $ec2->associate_route_table($subnet_id => $route_table_id)
$associationId = $ec2->associate_route_table(-subnet_id => $id, -route_table_id => $id)
This links a route table up with a subnet. They're a couple now. π«Ά Both objects have to be in the same VPC though β no long-distance, sorry. You can pass either plain string IDs, or VM::EC2::VPC::RouteTable and VM::EC2::VPC::Subnet objects.
On success you get an associationID back, and you can use that later to disassociate the route table from the subnet. You can also find that association ID by digging through the VM::EC2::VPC::RouteTable object.
Required arguments:
-subnet_idβ The subnet ID or aVM::EC2::VPC::Subnetobject.-route_table_idβ The route table ID or aVM::EC2::VPC::RouteTableobject.
It might be way more convenient to just call the VM::EC2::VPC::Subnet->associate_route_table() or VM::EC2::VPC::RouteTable->associate_subnet() methods instead β those are literally front ends to this exact method. iykyk. π
$success = $ec2->dissociate_route_table($association_id)
$success = $ec2->dissociate_route_table(-association_id => $id)
Breaks a route table up with a subnet. It's giving conscious uncoupling. π
You must provide the association ID β either the one you got back from associate_route_table(), or one you found among the associations() of a RouteTable object. Use the short single-argument form, or the longer named argument form with the required argument -association_id.
Returns true on success. Slay.
$new_association = $ec2->replace_route_table_association($association_id=>$route_table_id)
$new_association = $ec2->replace_route_table_association(-association_id => $id, -route_table_id => $id)
Swaps out which route table is associated with a given subnet. Glow-up for your routing. β¨
You have to pass the replacement route table ID and the association ID. Wanna replace the main route table? Use its association ID and the ID of the route table you want to replace it with.
On success, a new associationID comes back to you.
Required arguments:
-association_idβ The association ID-route_table_idβ The route table ID or aM::EC2::VPC::RouteTableobject. (That's literally how it's written in the docs βM::, noV. Typo behavior π but we reproduce it faithfully.)
$success = $ec2->create_route($route_table_id,$destination,$target)
$success = $ec2->create_route(-route_table_id => $id, -destination_cidr_block => $block, -target=>$target)
This creates a routing rule in a route table inside a VPC. Three mandatory arguments: the route table, the CIDR address block you're matching packet destinations against, and a target to route matching packets to. That target can be an internet gateway, a NAT instance, or a network interface ID.
Here's the tea on how routing works: network packets get routed by matching their destination addresses against a CIDR block. For example, 0.0.0.0/0 matches all addresses, while 10.0.1.0/24 matches 10.0.1.* addresses. When a packet matches more than one rule, the most specific matching routing rule is the one chosen. Most specific wins, always. π
In the named argument form, these arguments are recognized:
-route_table_idβ The ID of a route table, or aVM::EC2::VPC::RouteTableobject.-destination_cidr_blockβ The CIDR address block to match against packet destinations.-destinationβ A shorthand version of-destination_cidr_block.-targetβ The destination of matching packets. See below for valid targets.
The -target value can be any one of the following:
- A
VM::EC2::VPC::InternetGatewayobject, or an internet gateway ID matching the regex/^igw-[0-9a-f]{8}$/ - A
VM::EC2::Instanceobject, or an instance ID matching the regex/^i-[0-9a-f]{8}$/. - A
VM::EC2::NetworkInterfaceobject, or a network interface ID matching the regex/^eni-[0-9a-f]{8}$/. - A
VM::EC2::VPC::PeeringConnectionobject, or a VPC peering connection ID matching the regex/^pcx-[0-9a-f]{8}$/.
On success, this method returns true. Periodt. β
$success = $ec2->delete_route($route_table_id,$destination_block)
Deletes a route in the routing table you specify. The destination CIDR block is what tells it which route to delete. On success, the method returns true. Bye bye route. π
$success = $ec2->replace_route($route_table_id,$destination,$target)
$success = $ec2->replace_route(-route_table_id => $id, -destination_cidr_block => $block, -target=>$target)
Replaces an existing routing rule in a route table inside a VPC. It takes three mandatory arguments: the route table, the CIDR address block to match packet destinations against, and a target to route matching packets to. The target may be an internet gateway, a NAT instance, or a network interface ID.
Same routing lore as before, bestie: network packets are routed by matching their destination addresses against a CIDR block. For example, 0.0.0.0/0 matches all addresses, while 10.0.1.0/24 matches 10.0.1.* addresses. When a packet matches more than one rule, the most specific matching routing rule is chosen. π
In the named argument form, the following arguments are recognized:
-route_table_idβ The ID of a route table, or aVM::EC2::VPC::RouteTableobject.-destination_cidr_blockβ The CIDR address block to match against packet destinations.-destinationβ A shorthand version of-destination_cidr_block.-targetβ The destination of matching packets. See below for valid targets.
The -target value can be any one of the following:
- A
VM::EC2::VPC::InternetGatewayobject, or an internet gateway ID matching the regex/^igw-[0-9a-f]{8}$/ - A
VM::EC2::Instanceobject, or an instance ID matching the regex/^i-[0-9a-f]{8}$/. - A
VM::EC2::NetworkInterfaceobject, or a network interface ID matching the regex/^eni-[0-9a-f]{8}$/. - A
VM::EC2::VPC::PeeringConnectionobject, or a VPC peering connection ID matching the regex/^pcx-[0-9a-f]{8}$/.
On success, this method returns true. π
π§ SEE ALSO π§
VM::EC2
π AUTHOR π
Lincoln Stein <lincoln.stein@gmail.com>. Legend behavior, honestly.
Copyright (c) 2011 Ontario Institute for Cancer Research
This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.
Okay so this whole thing isperl v5.38.2, dated2024-08-10, and it's theVM::EC2::REST::route_tablepage from the User Contributed Perl Documentation β and that's the wrap, bestie. Go build some routes. ππ π¦
π¦ where this page comes from
- debian trixie: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu resolute: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu stonking: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms