1VM::EC2::REST::subnet(3U)ser Contributed Perl DocumentatiVoMn::EC2::REST::subnet(3)
2
3
4
7 use VM::EC2 ':vpc';
8
10 These methods manage subnet objects and the routing among them. A VPC
11 may have a single subnet or many, and routing rules determine whether
12 the subnet has access to the internet ("public"), is entirely private,
13 or is connected to a customer gateway device to form a Virtual Private
14 Network (VPN) in which your home network's address space is extended
15 into the Amazon VPC.
16
17 All instances in a VPC are located in one subnet or another. Subnets
18 may be public or private, and are organized in a star topology with a
19 logical router in the middle.
20
21 Although all these methods can be called from VM::EC2 objects, many are
22 more conveniently called from the VM::EC2::VPC object family. This
23 allows for steps that typically follow each other, such as creating a
24 route table and associating it with a subnet, happen automatically. For
25 example, this series of calls creates a VPC with a single subnet,
26 creates an Internet gateway attached to the VPC, associates a new route
27 table with the subnet and then creates a default route from the subnet
28 to the Internet gateway.
29
30 $vpc = $ec2->create_vpc('10.0.0.0/16') or die $ec2->error_str;
31 $subnet1 = $vpc->create_subnet('10.0.0.0/24') or die $vpc->error_str;
32 $gateway = $vpc->create_internet_gateway or die $vpc->error_str;
33 $routeTbl = $subnet->create_route_table or die $vpc->error_str;
34 $routeTbl->create_route('0.0.0.0/0' => $gateway) or die $vpc->error_str;
35
36 Implemented:
37 CreateSubnet
38 DeleteSubnet
39 DescribeSubnets
40
41 Unimplemented:
42 (none)
43
44 $subnet = $ec2->create_subnet(-vpc_id=>$id,-cidr_block=>$block)
45 This method creates a new subnet within the given VPC. Pass a VPC
46 object or VPC ID, and a CIDR block string. If successful, the method
47 will return a VM::EC2::VPC::Subnet object.
48
49 Required arguments:
50
51 -vpc_id A VPC ID or previously-created VM::EC2::VPC object.
52
53 -cidr_block A CIDR block string in the form "xx.xx.xx.xx/xx". The
54 CIDR address must be within the CIDR block previously
55 assigned to the VPC, and must not overlap other subnets
56 in the VPC.
57
58 Optional arguments:
59
60 -availability_zone The availability zone for the instances launched
61 within this instance, either an availability zone
62 name, or a VM::EC2::AvailabilityZone object. If
63 this is not specified, then AWS chooses a zone for
64 you automatically.
65
66 $success = $ec2->delete_subnet($subnet_id)
67 $success = $ec2->delete_subnet(-subnet_id=>$id)
68 This method deletes the indicated subnet. It may be called with a
69 single argument consisting of the subnet ID, or a named argument form
70 with the argument -subnet_id.
71
72 @subnets = $ec2->describe_subnets(@subnet_ids)
73 @subnets = $ec2->describe_subnets(\%filters)
74 @subnets = $ec2->describe_subnets(-subnet_id=>$id, -filter => \%filters)
75 This method returns a list of VM::EC2::VPC::Subnet objects. Called with
76 no arguments, it returns all Subnets (not filtered by VPC Id). Pass a
77 list of subnet IDs or a filter hashref in order to restrict the search.
78
79 Optional arguments:
80
81 -subnet_id Scalar or arrayref of subnet IDs.
82 -filter Hashref of filters.
83
84 Available filters are described at
85 http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html
86
87 $success = $ec2->modify_subnet_attribute(-subnet_id => $sub_id,
88 -map_public_ip_on_launch => $boolean)
89 Modifies a subnet attribute.
90
91 Required arguments:
92
93 -subnet_id The ID of the subnet to modify.
94
95 -map_public_ip_on_launch Modifies the public IP addressing behavior for the
96 subnet. Specify true to indicate that instances
97 launched into the specified subnet should be
98 assigned a public IP address. If set to true, the
99 instance receives a public IP address only if the
100 instance is launched with a single, new network
101 interface with the device index of 0.
102
103 Returns true on success.
104
106 VM::EC2
107
109 Lincoln Stein <lincoln.stein@gmail.com>.
110
111 Copyright (c) 2011 Ontario Institute for Cancer Research
112
113 This package and its accompanying libraries is free software; you can
114 redistribute it and/or modify it under the terms of the GPL (either
115 version 1, or at your option, any later version) or the Artistic
116 License 2.0. Refer to LICENSE for the full license text. In addition,
117 please see DISCLAIMER.txt for disclaimers of warranty.
118
119
120
121perl v5.32.0 2020-07-28 VM::EC2::REST::subnet(3)