VM::EC..._table(3pm)

πŸ“¦
version 1.28 Β· 7 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ 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):

  • AssociateRouteTable
  • CreateRoute
  • CreateRouteTable
  • DeleteRoute
  • DeleteRouteTable
  • DescribeRouteTables
  • DisassociateRouteTable
  • ReplaceRoute
  • ReplaceRouteTableAssociation

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-created VM::EC2::VPC object.

$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:

http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeRouteTables.html

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 a VM::EC2::VPC::Subnet object.
  • -route_table_id β€” The route table ID or a VM::EC2::VPC::RouteTable object.

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 a M::EC2::VPC::RouteTable object. (That's literally how it's written in the docs β€” M::, no V. 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 a VM::EC2::VPC::RouteTable object.
  • -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:

  1. A VM::EC2::VPC::InternetGateway object, or an internet gateway ID matching the regex /^igw-[0-9a-f]{8}$/
  2. A VM::EC2::Instance object, or an instance ID matching the regex /^i-[0-9a-f]{8}$/.
  3. A VM::EC2::NetworkInterface object, or a network interface ID matching the regex /^eni-[0-9a-f]{8}$/.
  4. A VM::EC2::VPC::PeeringConnection object, 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 a VM::EC2::VPC::RouteTable object.
  • -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:

  1. A VM::EC2::VPC::InternetGateway object, or an internet gateway ID matching the regex /^igw-[0-9a-f]{8}$/
  2. A VM::EC2::Instance object, or an instance ID matching the regex /^i-[0-9a-f]{8}$/.
  3. A VM::EC2::NetworkInterface object, or a network interface ID matching the regex /^eni-[0-9a-f]{8}$/.
  4. A VM::EC2::VPC::PeeringConnection object, 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 is perl v5.38.2, dated 2024-08-10, and it's the VM::EC2::REST::route_table page from the User Contributed Perl Documentation β€” and that's the wrap, bestie. Go build some routes. πŸŽ€πŸ’…πŸ¦‹
πŸ“¦ where this page comes from