CreateSubnet

POST {{baseUrl}}/subnets

Creates a new subnet in the specified VCN. You can't change the size of the subnet after creation, so it's important to think about the size of subnets you need before creating them. For more information, see VCNs and Subnets. For information on the number of subnets you can have in a VCN, see Service Limits.

For the purposes of access control, you must provide the OCID of the compartment where you want the subnet to reside. Notice that the subnet doesn't have to be in the same compartment as the VCN, route tables, or other Networking Service components. If you're not sure which compartment to use, put the subnet in the same compartment as the VCN. For more information about compartments and access control, see Overview of the IAM Service. For information about OCIDs, see Resource Identifiers.

You may optionally associate a route table with the subnet. If you don't, the subnet will use the VCN's default route table. For more information about route tables, see Route Tables.

You may optionally associate a security list with the subnet. If you don't, the subnet will use the VCN's default security list. For more information about security lists, see Security Lists.

You may optionally associate a set of DHCP options with the subnet. If you don't, the subnet will use the VCN's default set. For more information about DHCP options, see DHCP Options.

You may optionally specify a display name for the subnet, 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 subnet, which is required if you want the Internet and VCN Resolver to resolve hostnames for instances in the subnet. For more information, see DNS in Your Virtual Cloud Network.

Request Body

{"compartmentId"=>"{{compartment_ocid}}", "cidrBlock"=>"et ut irure", "vcnId"=>"officia nostrud veniam dolore", "availabilityDomain"=>"ea", "dhcpOptionsId"=>"sed qui", "displayName"=>"ex aliquip consectetur", "dnsLabel"=>"quis ut", "ipv6CidrBlock"=>"exercitation", "prohibitPublicIpOnVnic"=>true, "routeTableId"=>"occaecat fugiat veniam", "securityListIds"=>["do", "laboris aliqua aute voluptate eu"]}

HEADERS

KeyDatatypeRequiredDescription
opc-retry-tokenstringA 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-Typestring
Datestring(Required) Current Date
Authorizationstring(Required) Signature Authentication on Authorization header
x-content-sha256string(Required) Content sha256 for POST, PUT and PATCH operations

RESPONSES

status: OK

{"vcnId":"sit","id":"reprehenderit Excepteur amet","compartmentId":"veniam ut dolore","cidrBlock":"ea aliquip Duis","routeTableId":"aute et","virtualRouterIp":"eiusmod do in pariatur","virtualRouterMac":"sit","lifecycleState":"PROVISIONING","availabilityDomain":"reprehenderit est Excepteur laboris","definedTags":{},"dhcpOptionsId":"in ex","displayName":"ut Ut ad elit","dnsLabel":"ipsum dolor sin","freeformTags":{},"ipv6CidrBlock":"dolore id","ipv6PublicCidrBlock":"est et nostrud adipisicing","ipv6VirtualRouterIp":"enim","prohibitPublicIpOnVnic":false,"securityListIds":["deserunt eiusmod sint aute","cupidatat tempor"],"subnetDomainName":"ea dolore","timeCreated":"1973-06-27T12:37:33.677Z"}