Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2015-10-01)

CreateVpc

Creates a VPC with the specified CIDR block.

The smallest VPC you can create uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses). To help you decide how big to make your VPC, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide.

By default, each instance you launch in the VPC has the default DHCP options, which includes only a default DNS server that we provide (AmazonProvidedDNS). For more information about DHCP options, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide.

You can specify the instance tenancy value for the VPC when you create it. You can't change this value for the VPC after you create it. For more information, see Dedicated Instances in the Amazon Virtual Private Cloud User Guide.

Request Parameters

For information about the common parameters that all actions use, see Common Query Parameters.

CidrBlock

The network range for the VPC, in CIDR notation. For example, 10.0.0.0/16.

Type: String

Required: Yes

DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No

InstanceTenancy

The tenancy options for instances launched into the VPC. For default, instances are launched with shared tenancy by default. You can launch instances with any tenancy into a shared tenancy VPC. For dedicated, instances are launched as dedicated tenancy instances by default. You can only launch instances with a tenancy of dedicated or host into a dedicated tenancy VPC.

Important: The host value cannot be used with this parameter. Use the default or dedicated values only.

Default: default

Type: String

Valid Values: default | dedicated | host

Required: No

Response Elements

The following elements are returned.

requestId

The ID of the request.

Type: String

vpc

Information about the VPC.

Type: Vpc

Errors

For information about the errors that are common to all actions, see Common Client Errors.

Examples

Example 1

This example creates a VPC with the CIDR block 10.0.0.0/16.

Sample Request

https://ec2.amazonaws.com/?Action=CreateVpc
&CidrBlock=10.0.0.0/16
&AUTHPARAMS

Sample Response

<CreateVpcResponse xmlns="http://ec2.amazonaws.com/doc/2015-10-01/">					
   <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
   <vpc>
      <vpcId>vpc-1a2b3c4d</vpcId>
      <state>pending</state>
      <cidrBlock>10.0.0.0/16</cidrBlock>   
      <dhcpOptionsId>dopt-1a2b3c4d2</dhcpOptionsId>
      <instanceTenancy>default</instanceTenancy>
      <tagSet/>
   </vpc>
</CreateVpcResponse>

Example 2

This example creates a VPC with the dedicated tenancy option.

Sample Request

https://ec2.amazonaws.com/?Action=CreateVpc
&CidrBlock=10.32.0.0/16
&InstanceTenancy=dedicated
&AUTHPARAMS

Sample Response

<CreateVpcResponse xmlns="http://ec2.amazonaws.com/doc/2015-10-01/">
    <requestId>a9e49797-a74f-4f68-b302-a134a51fd054</requestId>
    <vpc>
        <vpcId>vpc-11a63c78</vpcId>
        <state>pending</state>
        <cidrBlock>10.32.0.0/16</cidrBlock>
        <dhcpOptionsId>dopt-1a2b3c4d2</dhcpOptionsId>
        <instanceTenancy>dedicated</instanceTenancy>
    </vpc>
</CreateVpcResponse>