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

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

πŸ’– VM::EC2::VPC::Route β€” bestie's guide to one lil' row in a VPC routing table πŸ’–

okay so. you're holding a page from the User Contributed Perl Documentation for the module VM::EC2::VPC::Route(3pm), and honestly? it's giving "tiny object, big responsibilities." πŸŽ€


✨ NAME ✨

VM::EC2::VPC::Route β€” literally one single entry in a VPC routing table. that's it. that's the whole vibe. one row. one glow-up. πŸ’…


🌸 SYNOPSIS 🌸

here's how you actually meet these lil guys in the wild:

use VM::EC2;
my $ec2     = VM::EC2->new(...);
my $table  = $ec2->describe_route_tables('rtb-123456');
my @routes = $table->routes;

foreach my $r (@routes) {
      print $r->destinationCidrBlock,"\n",
            $r->gatewayId,"\n",
            $r->instanceId,"\n",
            $r->instanceOwnerId,"\n",
            $r->networkInterfaceId,"\n",
            $r->state,"\n"
      my $target = $r->target,"\n";  # an instance, gateway or network interface object
}

like yes bestie you pull the route table with describe_route_tables('rtb-123456'), grab @routes off it, and loop through every single one. iconic behavior. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so this object is your lil' handler for the EC2 Virtual Private Cloud route interface, and its whole job is controlling how packets get routed around within and between subnets. no cap.

every route has, like, two main character traits:

  • a destination CIDR address block β€” the "who is this for" part
  • a target that receives the packets β€” could be a gateway, an instance, or a network interface β€” and it only catches packets whose destination actually matches that block

and here's the part you need to internalize fr fr: routes get matched in order from the most specific to the most general. most specific wins first. periodt.


🫢 METHODS 🫢

these object methods are supported, and they are lowkey the whole personality of this thing:

  • destinationCidrBlock β€” the CIDR address block used in the destination match. for example 0.0.0/0 for all packets. yes, everything. the whole internet. hi. 🌈
  • gatewayId β€” the ID of an internet gateway attached to your VPC.
  • instanceId β€” the ID of an instance in your VPC acting as the destination for packets. typically this is gonna be a NAT instance. πŸ‘€
  • instanceOwnerId β€” the account number of the owner of that instance.
  • networkInterfaceId β€” the ID of an Elastic Network Interface that receives packets matching the destination.
  • state β€” one of "active" or "blackhole". and the blackhole state? it applies when the route's target isn't usable for one reason or another. πŸ’€ not the target ghosting you.

✨ convenience methods (the little extras) ✨

in addition, the following convenience methods are provided:

  • target β€” returns the target of the route. this method hands you back a VM::EC2::Instance, VM::EC2::VPC::InternetGateway, or VM::EC2::NetworkInterface object, depending on the nature of the target. so you don't even have to guess which one it is, it just knows. main character energy fr.
  • instance β€” if an instance is the target, return the corresponding VM::EC2::Instance object.
  • gateway β€” if a gateway is the target, return the corresponding VM::EC2::VPC::InternetGateway object.
  • network_interface β€” if a network interface is the target, return the corresponding VM::EC2::NetworkInterface object.

πŸ’… STRING OVERLOADING πŸ’…

when you use this object in a string context, it gets interpolated as the destinationCidrBlock. so yes, you can just drop it in a string and it will show up as its CIDR block. slay. ✨


🌟 SEE ALSO 🌟

  • VM::EC2
  • VM::EC2::Generic

go check 'em out, they're the friend group. πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

Lincoln Stein <lincoln.stein@gmail.com>.

Copyright (c) 2012 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.


πŸŽ€ and that's the whole page bestie β€” this doc came from perl v5.38.2, dated 2024-08-10, under the VM::EC...::Route(3pm) banner. go route those packets. i'm obsessed with you. πŸ’–βœ¨πŸŒΈ
πŸ“¦ where this page comes from