Creates a VPC with the CIDR block you specify. The smallest VPC you can create uses a
/28
netmask (16 IP addresses), and the largest uses a /18
netmask
(16,384 IP addresses). To help you decide how big to make your VPC, go to the topic about
creating VPCs in the Amazon Virtual Private Cloud Developer Guide.
By default, each instance you launch in the VPC has the default DHCP options (the standard EC2 host name, no domain name, no DNS server, no NTP server, and no NetBIOS server or node type).
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
A valid CIDR block. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Create a new virtual private cloud.
Here is the flow:
- Create a new VPC with
create_vpc()
and a CIDR block. - Create a new Route Table with
create_route_table()
. - Create a new Internet Gateway with
create_internet_gateway()
. - Attach the Internet Gateway to the VPC with
attach_internet_gateway()
. - Create a new Route with
create_route()
.
$ec2 = new AmazonEC2(); $response = $ec2->create_vpc('10.0.0.0/20'); var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/ec2.class.php | Toggle source view (7 lines) | View on GitHub