CreateSubnet
/20160918/subnets
Note: You cannot change the size of the subnet after the subnet is created.
You must provide the OCID of the compartment where you want the subnet to reside. The subnet does not need to be in the same compartment as the VCN, route tables, or other Networking Service components. If you are not sure which compartment to use, put the subnet in the same compartment as the VCN.
You may optionally associate a route table with the subnet. If you do not, the subnet will use the VCN's default route table.
You may optionally associate a security list with the subnet. If you do not, the subnet will use the VCN's default security list.
You may optionally associate a set of DHCP options with the subnet. If you do not, the subnet will use the VCN's default set of DHCP options.
You may optionally specify a display name for the subnet. If you do not, a default display name is provided. The display name does not need to be unique, and you can change it. Avoid entering confidential information.
You can add a DNS label for the subnet. A DNS label is required if you want the Internet and VCN Resolver to resolve hostnames for instances in the subnet.
Request
- application/json
-
opc-retry-token: string
Minimum Length:
1
Maximum Length:64
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).
object
-
availabilityDomain:
string
Minimum Length:
1
Maximum Length:255
Controls whether the subnet is regional. To create a regional subnet, omit this attribute. -
cidrBlock(required):
string
Minimum Length:
1
Maximum Length:32
The CIDR IP address range of the subnet. The CIDR must maintain the following rules- The CIDR block is valid and correctly formatted.
- The new range is within one of the parent VCN ranges.
-
compartmentId(required):
string
Minimum Length:
1
Maximum Length:255
The OCID of the compartment to contain the subnet. -
definedTags:
object definedTags
Additional Properties Allowed: additionalPropertiesDefined tags for this resource. Each key is predefined and scoped to a namespace.
-
dhcpOptionsId:
string
Minimum Length:
1
Maximum Length:255
The OCID of the set of DHCP options the subnet will use. If you don't provide a value, the subnet uses the VCN's default set of DHCP options. -
displayName:
string
Minimum Length:
1
Maximum Length:255
A user-friendly name. Does not need to be unique, and it is changeable. Avoid entering confidential information. -
dnsLabel:
string
Minimum Length:
1
Maximum Length:15
A DNS label for the subnet, used in conjunction with the VNIC's hostname and VCN's DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet (for example, bminstance-1.subnet123.vcn1.oraclevcn.com). Must be an alphanumeric string that begins with a letter and is unique within the VCN. The value cannot be changed. This value must be set if you want to use the Internet and VCN Resolver to resolve the hostnames of instances in the subnet. It can only be set if the VCN itself was created with a DNS label. Example: subnet123 -
freeformTags:
object freeformTags
Additional Properties Allowed: additionalPropertiesFree-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
-
ipv6CidrBlock:
string
Minimum Length:
1
Maximum Length:45
Use this to enable IPv6 addressing for this subnet. The VCN must be enabled for IPv6. You can't change this subnet characteristic later. All subnets are /64 in size. The subnet portion of the IPv6 address is the fourth hextet from the left, 1111 in the following example: 2001:0db8:0123:1111::/64 -
ipv6CidrBlocks:
array ipv6CidrBlocks
Unique Items Required:
true
The list of all IPv6 CIDR blocks (Oracle allocated IPv6 GUA, ULA or private IPv6 CIDR blocks, BYOIPv6 CIDR blocks) for the subnet that meets the following criteria: - The CIDR blocks must be valid. - Multiple CIDR blocks must not overlap each other or the on-premises network CIDR block. - The number of CIDR blocks must not exceed the limit of IPv6 CIDR blocks allowed to a subnet. -
isLearningEnabled:
boolean
Indicates whether learning mode is enabled for this subnet. The default is false. Note: When a subnet has learning mode enabled, only certain types of resources can be launched in the subnet. Example: true
-
prohibitInternetIngress:
boolean
Whether to disallow ingress internet traffic to VNICs within this subnet. Defaults to false. For IPv6, if prohibitInternetIngress is set to true, internet access is not allowed for any IPv6s assigned to VNICs in the subnet. Otherwise, ingress internet traffic is allowed by default. prohibitPublicIpOnVnic will be set to the value of prohibitInternetIngress to dictate IPv4 behavior in this subnet. Only one or the other flag should be specified. Example: true
-
prohibitPublicIpOnVnic:
boolean
Whether VNICs within this subnet can have public IP addresses. Defaults to false, which means VNICs created in this subnet will automatically be assigned public IP addresses unless specified otherwise during instance launch or VNIC creation (with the assignPublicIp flag in CreateVnicDetails). If prohibitPublicIpOnVnic is set to true, VNICs created in this subnet cannot have public IP addresses (that is, it's a private subnet). If you intend to use an IPv6 CIDR block, you should use the flag prohibitInternetIngress to specify ingress internet traffic behavior of the subnet. Example: true
-
routeTableId:
string
Minimum Length:
1
Maximum Length:255
The OCID of the route table the subnet will use. If you don't provide a value, the subnet uses the VCN's default route table. -
securityListIds:
array securityListIds
The OCIDs of the security list or lists the subnet will use. If you don't provide a value, the subnet uses the VCN's default security list. Remember that security lists are associated *with the subnet*, but the rules are applied to the individual VNICs in the subnet.
-
vcnId(required):
string
Minimum Length:
1
Maximum Length:255
The OCID of the VCN to contain the subnet. -
vlanTag:
integer(int32)
Minimum Value:
1
Maximum Value:4094
The VLAN tag to associate with every VNIC Attachment within this Subnet, available only on BareMetal secondary VNICs within learning enabled Subnets. Note: If the Subnet is learning enabled, the vlanTag value has to be passed in and cannot be empty.
object
-
object additionalProperties
Additional Properties Allowed: additionalPropertiesKey-value pair representing a defined tag key and value, scoped to a namespace.
object
array
true
-
Array of:
string
Minimum Length:
1
Maximum Length:45
array
-
Array of:
string
Minimum Value:
0
Maximum Value:5
Minimum Length:1
Maximum Length:255
object
-
object additionalProperties
The value of the tag. Only the String type is supported.
object
Response
- application/json
200 Response
-
etag: string
For optimistic concurrency control. See if-match.
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
object
-
availabilityDomain:
string
Minimum Length:
1
Maximum Length:255
The subnet's availability domain. This attribute will be null if this is a regional subnet instead of an AD-specific subnet. Oracle recommends creating regional subnets. Example: AD-1 -
cidrBlock(required):
string
Minimum Length:
1
Maximum Length:32
The subnet's CIDR block. Example: 10.0.1.0/24 -
compartmentId(required):
string
Minimum Length:
1
Maximum Length:255
The OCID of the compartment containing the subnet. -
definedTags:
object definedTags
Additional Properties Allowed: additionalPropertiesDefined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"Operations": {"CostCenter": "42"}}
-
dhcpOptionsId:
string
Minimum Length:
1
Maximum Length:255
The OCID of the set of DHCP options that the subnet uses. -
displayName:
string
Minimum Length:
1
Maximum Length:255
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. -
dnsLabel:
string
Minimum Length:
1
Maximum Length:15
A DNS label for the subnet, used in conjunction with the VNIC's hostname and VCN's DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet (for example, bminstance-1.subnet123.vcn1.oraclevcn.com). Must be an alphanumeric string that begins with a letter and is unique within the VCN. The value cannot be changed. The absence of this parameter means the Internet and VCN Resolver will not resolve hostnames of instances in this subnet. Example: subnet123 -
freeformTags:
object freeformTags
Additional Properties Allowed: additionalPropertiesFree-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
-
id(required):
string
Minimum Length:
1
Maximum Length:255
The subnet's OCID. -
ipv6CidrBlock:
string
Minimum Length:
1
Maximum Length:45
For an IPv6-enabled subnet, this is the IPv6 CIDR block for the subnet's IP address space. The subnet size is always /64. Example: 2001:0db8:0123:1111::/64 -
ipv6CidrBlocks:
array ipv6CidrBlocks
Unique Items Required:
true
The list of all IPv6 CIDR blocks (Oracle allocated IPv6 GUA, ULA or private IPv6 CIDR blocks, BYOIPv6 CIDR blocks) for the subnet. -
ipv6PublicCidrBlock:
string
Minimum Length:
1
Maximum Length:45
To be deprecated. -
ipv6VirtualRouterIp:
string
Minimum Length:
1
Maximum Length:45
For an IPv6-enabled subnet, this is the IPv6 address of the virtual router. Example: 2001:0db8:0123:1111:89ab:cdef:1234:5678 -
isLearningEnabled:
boolean
Whether learning mode is enabled for this subnet. The default is false. Note: When a subnet has learning mode enabled, only certain types of resources can be launched in the subnet.
-
lifecycleState(required):
string
Allowed Values:
[ "PROVISIONING", "AVAILABLE", "TERMINATING", "TERMINATED", "UPDATING" ]
The subnet's current state. -
prohibitInternetIngress:
boolean
Whether to disallow ingress internet traffic to VNICs within this subnet. Defaults to false. For IPV4, prohibitInternetIngress behaves similarly to prohibitPublicIpOnVnic. If it is set to false, VNICs created in this subnet will automatically be assigned public IP addresses unless specified otherwise during instance launch or VNIC creation (with the assignPublicIp flag in CreateVnicDetails). If prohibitInternetIngress is set to true, VNICs created in this subnet cannot have public IP addresses (that is, it's a private subnet). For IPv6, if prohibitInternetIngress is set to true, internet access is not allowed for any IPv6s assigned to VNICs in the subnet. Otherwise, ingress internet traffic is allowed by default.
-
prohibitPublicIpOnVnic:
boolean
Whether VNICs within this subnet can have public IP addresses. Defaults to false, which means VNICs created in this subnet will automatically be assigned public IP addresses unless specified otherwise during instance launch or VNIC creation (with the assignPublicIp flag in CreateVnicDetails). If prohibitPublicIpOnVnic is set to true, VNICs created in this subnet cannot have public IP addresses (that is, it's a private subnet).
-
routeTableId(required):
string
Minimum Length:
1
Maximum Length:255
The OCID of the route table that the subnet uses. -
securityListIds:
array securityListIds
The OCIDs of the security list or lists that the subnet uses. Remember that security lists are associated with the subnet, but the rules are applied to the individual VNICs in the subnet.
-
subnetDomainName:
string
Minimum Length:
1
Maximum Length:253
The subnet's domain name, which consists of the subnet's DNS label, the VCN's DNS label, and the domain. Example: subnet123.vcn1.oraclevcn.com -
timeCreated:
string(date-time)
The date and time the subnet was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: 2016-08-25T21:10:29.600Z
-
vcnId(required):
string
Minimum Length:
1
Maximum Length:255
The OCID of the VCN the subnet is in. -
virtualRouterIp(required):
string
Minimum Length:
1
Maximum Length:32
The IP address of the virtual router. Example: 10.0.14.1 -
virtualRouterMac(required):
string
Minimum Length:
1
Maximum Length:32
The MAC address of the virtual router. Example: 00:00:00:00:00:01 -
vlanTag:
integer(int32)
The VLAN tag assigned to VNIC Attachments within this Subnet if the Subnet has learning enabled. Note: When a subnet does not have learning enabled, this field will be null. Example: 100
object
-
object additionalProperties
Additional Properties Allowed: additionalPropertiesKey-value pair representing a defined tag key and value, scoped to a namespace. Example: {"CostCenter": "42"}
object
array
true
-
Array of:
string
Minimum Length:
1
Maximum Length:45
array
-
Array of:
string
Minimum Value:
0
Maximum Value:5
Minimum Length:1
Maximum Length:255
object
-
object additionalProperties
The value of the tag. Only the String type is supported.
object
400 Response
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
object
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing..Example:
UnknownError
-
message(required):
string
A human-readable error string.Example:
error validating payload
401 Response
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
object
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing..Example:
UnknownError
-
message(required):
string
A human-readable error string.Example:
error validating payload
404 Response
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
object
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing..Example:
UnknownError
-
message(required):
string
A human-readable error string.Example:
error validating payload
409 Response
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
object
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing..Example:
UnknownError
-
message(required):
string
A human-readable error string.Example:
error validating payload
500 Response
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
object
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing..Example:
UnknownError
-
message(required):
string
A human-readable error string.Example:
error validating payload
Default Response
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
object
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing..Example:
UnknownError
-
message(required):
string
A human-readable error string.Example:
error validating payload