Create VCN
POST https://iaas.{{region}}.oraclecloud.com/20160918/vcns
Creates a new virtual cloud network (VCN). For more information, see VCNs and Subnets.
For the VCN, you specify a list of one or more IPv4 CIDR blocks that meet the following criteria:
- The CIDR blocks must be valid.
- They must not overlap with each other or with the on-premises network CIDR block.
- The number of CIDR blocks does not exceed the limit of CIDR blocks allowed per VCN.
For a CIDR block, Oracle recommends that you use one of the private IP address ranges specified in RFC 1918 (10.0.0.0/8, 172.16/12, and 192.168/16). Example: 172.16.0.0/16. The CIDR blocks can range from /16 to /30.
For the purposes of access control, you must provide the OCID of the compartment where you want the VCN to reside. Consult an Oracle Cloud Infrastructure administrator in your organization if you're not sure which compartment to use. Notice that the VCN doesn't have to be in the same compartment as the subnets or other Networking Service components. For more information about compartments and access control, see Overview of the IAM Service. For information about OCIDs, see Resource Identifiers.
You may optionally specify a display name for the VCN, otherwise a default is provided. It does not have to be unique, and you can change it. Avoid entering confidential information.
You can also add a DNS label for the VCN, which is required if you want the instances to use the Interent and VCN Resolver option for DNS in the VCN. For more information, see DNS in Your Virtual Cloud Network.
The VCN automatically comes with a default route table, default security list, and default set of DHCP options. The OCID for each is returned in the response. You can't delete these default objects, but you can change their contents (that is, change the route rules, security list rules, and so on).
The VCN and subnets you create are not accessible until you attach an internet gateway or set up a Site-to-Site VPN or FastConnect. For more information, see Overview of the Networking Service.
Request Body
{"compartmentId"=>"{{app_compartment_ocid}}", "cidrBlock"=>"10.0.0.0/16", "displayName"=>"End-to-End API Example - VCN"}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
opc-retry-token | string | A token that uniquely identifies a request so it can be retried in case of a timeout or | |
server error without risk of executing that same action again. Retry tokens expire after 24 | |||
hours, but can be invalidated before then due to conflicting operations (for example, if a resource | |||
has been deleted and purged from the system, then a retry of the original creation request | |||
may be rejected). | |||
Content-Type | string | ||
Date | string | (Required) Current Date | |
Authorization | string | (Required) Signature Authentication on Authorization header | |
x-content-sha256 | string | (Required) Content sha256 for POST, PUT and PATCH operations |
RESPONSES
status: OK
{"id":"id magna consectetur","compartmentId":"proident ullamco et non","cidrBlock":"ut amet la","lifecycleState":"TERMINATING","cidrBlocks":["et","amet"],"defaultDhcpOptionsId":"qui officia reprehenderit Ut","defaultRouteTableId":"nulla incididunt exercitation fugiat","defaultSecurityListId":"eiusmod sint aliqua","definedTags":{},"displayName":"in","dnsLabel":"qui cupida","freeformTags":{},"ipv6CidrBlock":"aute Excepteur","ipv6PublicCidrBlock":"dolore ex dolor Lorem adipisicing","timeCreated":"1985-03-26T20:05:22.459Z","vcnDomainName":"ex laborum magna"}