VM::EC...Subnet(3pm)
π VM::EC2::VPC::Subnet β the perl manual page, bestie edition π
okay so. you're reading VM::EC2::VPC::Subnet(3pm) β that's a User Contributed Perl Documentation page, section 3pm, and it's all about the object that represents a VPC subnet in Amazon EC2. pull up a chair, we're doing cloud networking but make it cute β¨
πΈ NAME πΈ
VM::EC2::VPC::Subnet β literally just: a VPC subnet. that's the whole vibe. a subnet, but as a Perl object, and it's serving π
π SYNOPSIS π
here's how you'd actually use it, no cap:
use VM::EC2;
my $ec2 = VM::EC2->new(...);
my $vpc = $ec2->create_vpc('10.0.0.0/16');
my $subnet = $vpc->create_subnet('10.0.0.0/24') or die $vpc->error_str;
@subnets = $ec2->describe_subnets;
for my $sn (@subnets) {
print $sn->subnetId,"\n",
$sn->state,"\n",
$sn->vpcId,"\n",
$sn->cidrBlock,"\n",
$sn->availableIpAddressCount,"\n",
$sn->availabilityZone,"\n";
}
see? spin up an EC2 handle, make a VPC, make a subnet inside it, then loop over everything describe_subnets hands back and print the juicy bits. iconic. π¦
π«Ά DESCRIPTION π«Ά
so this object is the one that supports the EC2 Virtual Private Cloud subnet interface. that's its whole job, and it's doing great at it ngl.
also β and this part matters β there's a bunch of methods that every VM::EC2 object shares, and those live over in VM::EC2::Generic. go read that one too, bestie, this page isn't the whole story π
β¨ METHODS β¨
the object methods (the main cast)
these are the ones baked right into the object, fr fr:
subnetIdβ the ID of the subnet. its government name πͺͺstateβ the current state of the subnet, and it's either"pending"or"available". those are the only two options, don't @ mevpcIdβ the ID of the VPC the subnet is in. who's your parent πΌcidrBlockβ the CIDR block assigned to the subnetavailableIpAddressCountβ the number of unused IP addresses in the subnet. the headcount of available spots πavailableZoneβ this subnet's availability zonedefaultForAzβ indicates if this is the default subnet for the Availability ZonemapPublicIpOnLaunchβ indicates if instances launched in this subnet automatically receive a public IP address
tagging interface
this class supports the VM::EC2 tagging interface. for the details on that, go check out VM::EC2::Generic. iykyk π
the convenience methods (the bonus tracks)
and in addition, this object supports these convenience methods:
vpc()β return the associatedVM::EC2::VPCobjectzone()β return the associatedVM::EC2::AvailabilityZoneobjectrefresh()β refreshes the object from its current state in EC2current_state()β refreshes the object and returns its current statecreate_route_table()β create a new route table, associates it with this subnet, and returns the correspondingVM::EC2::VPC::RouteTableobjectassociate_route_table($table)β associates a route table with this subnet, returning true if successfuldisassociate_route_table($table)β removes the association of a route table with this subnet. > heads up: this produces a fatal error if$tableis not associated with the subnet. returns true on successassociate_network_acl($network_acl_id)β associates a network ACL with this subnet, returning the new association ID on successdisassociate_network_acl()β removes the association of a network ACL with this subnet. the subnet will then be associated with the default network ACL. returns the the association ID
π STRING OVERLOADING π
the way this object is so versatile β when you use it in a string context, it gets interpolated as the subnet ID. so you can just slap it in a string and it knows what to do. main character energy, genuinely π β¨
π SEE ALSO π
VM::EC2VM::EC2::Generic
go read those, they're the extended universe πΈ
π 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 was perl v5.38.2, dated 2024-08-10, and the page is VM::EC...Subnet(3pm) β slay, go make some subnets, and remember: no cap, only CIDR blocks π«Άπ
π¦ 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