Amazon Elastic Compute Cloud
API Reference (API Version 2014-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

CreateVpc

Description

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.

Request Parameters

CidrBlock

The CIDR block for the VPC (for example, 10.0.0.0/16).

Type: String

Default: None

Required: Yes

instanceTenancy

The supported tenancy options for instances launched into the VPC. A value of default means that instances can be launched with any tenancy; a value of dedicated means all instances launched into the VPC are launched as dedicated tenancy instances regardless of the tenancy assigned to the instance at launch. Dedicated tenancy instances runs on single-tenant hardware.

Type: String

Valid values: default | dedicated

Default: default

Required: No

Response Elements

The following elements are returned in a CreateVpcResponse element.

requestId

The ID of the request.

Type: xsd:string

vpc

Information about the VPC.

Type: VpcType

Errors

The following are some of the client API errors you may encounter when using this request. For more information about common API errors, see Common Causes of EC2 API Client Errors. For a summary of API error codes, see Client Error Codes.

Examples

Example Request

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

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

Example Response

<CreateVpcResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-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 Request

This example request creates a VPC with the dedicated tenancy option.

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

Example Response

<CreateVpcResponse xmlns="http://ec2.amazonaws.com/doc/2014-02-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>