++ed by:

3 PAUSE user(s)
1 non-PAUSE user(s).

Lincoln D. Stein
and 1 contributors


VM::EC2::VPC::Subnet -- A VPC subnet


 use VM::EC2;
 my $ec2     = VM::EC2->new(...);
 my $vpc     = $ec2->create_vpc('');
 my $subnet  = $vpc->create_subnet('')  or die $vpc->error_str;
 @subnets    = $ec2->describe_subnets;
 for my $sn (@subnets) {
    print $sn->subnetId,"\n",


This object supports the EC2 Virtual Private Cloud subnet interface. Please see VM::EC2::Generic for methods shared by all VM::EC2 objects.


These object methods are supported:

 subnetId   -- the ID of the subnet
 state      -- The current state of the subnet, either "pending" or "available"
 vpcId      -- The ID of the VPC the subnet is in.
 cidrBlock  -- The CIDR block assigned to the subnet.
 availableIpAddressCount -- The number of unused IP addresses in the subnet.
 availableZone -- This subnet's availability zone.
 defaultForAz  -- Indicates if this is the default subnet for the Availability Zone
 mapPublicIpOnLaunch -- Indicates if instances launched in this subnet automatically receive a
                        public IP address

This class supports the VM::EC2 tagging interface. See VM::EC2::Generic for information.

In addition, this object supports the following convenience methods:

 vpc()                -- Return the associated VM::EC2::VPC object.
 zone()               -- Return the associated VM::EC2::AvailabilityZone object.
 refresh()            -- Refreshes the object from its current state in EC2.
 current_state()      -- Refreshes the object and returns its current state.
 create_route_table() -- Create a new route table, associates it with this subnet, and
                         returns the corresponding VM::EC2::VPC::RouteTable
                      -- Associates a route table with this subnet, returning true if
                      -- Removes the association of a route table with this subnet. Produces
                         a fatal error if $table is not associated with the subnet. Returns true
                         on success.
                      -- Associates a network ACL with this subnet, returning the new
                         association ID on success.
                      -- 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.


When used in a string context, this object will be interpolated as the subnet ID.


VM::EC2 VM::EC2::Generic


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.