DOKK / manpages / debian 11 / libvm-ec2-perl / VM::EC2::VPC::Subnet.3pm.en
VM::EC2::VPC::Subnet(3pm) User Contributed Perl Documentation VM::EC2::VPC::Subnet(3pm)

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

 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";
 }

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
                         object.
 associate_route_table($table)
                      -- Associates a route table with this subnet, returning true if
                         sucessful.
 disassociate_route_table($table)
                      -- 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.
 associate_network_acl($network_acl_id)
                      -- Associates a network ACL with this subnet, returning the new
                         association ID on success.
 disassociate_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.

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.

2016-06-04 perl v5.22.2