vnic_attachments
Creates, updates, deletes, gets or lists a vnic_attachments resource.
Overview​
| Name | vnic_attachments |
| Type | Resource |
| Id | oci.compute.vnic_attachments |
Fields​
The following fields are returned by SELECT queries:
- get
- list
The VNIC attachment was retrieved.
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the VNIC attachment. |
availabilityDomain | string | The availability domain of the instance. Example: Uocm:PHX-AD-1 |
compartmentId | string | The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in. |
displayName | string | A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. |
instanceId | string | The OCID of the instance. |
lifecycleState | string | The current state of the VNIC attachment. (ATTACHING, ATTACHED, DETACHING, DETACHED) |
nicIndex | integer (int32) | Which physical network interface card (NIC) the VNIC uses. Certain bare metal instance shapes have two active physical NICs (0 and 1). If you add a secondary VNIC to one of these instances, you can specify which NIC the VNIC will use. For more information, see [Virtual Network Interface Cards (VNICs)](/iaas/Content/Network/Tasks/managingVNICs.htm). |
subnetId | string | The OCID of the subnet to create the VNIC in. |
timeCreated | string (date-time) | The date and time the VNIC attachment was created, in the format defined by [RFC3339](https:​//tools.ietf.org/html/rfc3339). Example: 2016-08-25T21:10:29.600Z |
vlanId | string | The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See [Vlan](#/en/iaas/latest/Vlan). An error is returned if the instance already has a VNIC attached to it from this VLAN. |
vlanTag | integer (int32) | The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete. However, if the VNIC belongs to a VLAN as part of the Oracle Cloud VMware Solution, the vlanTag value is instead the value of the vlanTag attribute for the VLAN. See [Vlan](#/en/iaas/latest/Vlan). Example: 0 |
vnicId | string | The OCID of the VNIC. Available after the attachment process is complete. |
Represents an attachment between a VNIC and an instance. For more information, see<br />[Virtual Network Interface Cards (VNICs)](/iaas/Content/Network/Tasks/managingVNICs.htm).<br /><br />Warning: Oracle recommends that you avoid using any confidential information when you<br />supply string values using the API.<br />
| Name | Datatype | Description |
|---|---|---|
id | string | The OCID of the VNIC attachment. |
availabilityDomain | string | The availability domain of the instance. Example: Uocm:PHX-AD-1 |
compartmentId | string | The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in. |
displayName | string | A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. |
instanceId | string | The OCID of the instance. |
lifecycleState | string | The current state of the VNIC attachment. (ATTACHING, ATTACHED, DETACHING, DETACHED) |
nicIndex | integer (int32) | Which physical network interface card (NIC) the VNIC uses. Certain bare metal instance shapes have two active physical NICs (0 and 1). If you add a secondary VNIC to one of these instances, you can specify which NIC the VNIC will use. For more information, see [Virtual Network Interface Cards (VNICs)](/iaas/Content/Network/Tasks/managingVNICs.htm). |
subnetId | string | The OCID of the subnet to create the VNIC in. |
timeCreated | string (date-time) | The date and time the VNIC attachment was created, in the format defined by [RFC3339](https:​//tools.ietf.org/html/rfc3339). Example: 2016-08-25T21:10:29.600Z |
vlanId | string | The OCID of the VLAN to create the VNIC in. Creating the VNIC in a VLAN (instead of a subnet) is possible only if you are an Oracle Cloud VMware Solution customer. See [Vlan](#/en/iaas/latest/Vlan). An error is returned if the instance already has a VNIC attached to it from this VLAN. |
vlanTag | integer (int32) | The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete. However, if the VNIC belongs to a VLAN as part of the Oracle Cloud VMware Solution, the vlanTag value is instead the value of the vlanTag attribute for the VLAN. See [Vlan](#/en/iaas/latest/Vlan). Example: 0 |
vnicId | string | The OCID of the VNIC. Available after the attachment process is complete. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | vnicAttachmentId, region | Gets the information for the specified VNIC attachment.<br /> | |
list | select | compartmentId, region | availabilityDomain, instanceId, limit, page, vnicId | Lists the VNIC attachments in the specified compartment. A VNIC attachment<br />resides in the same compartment as the attached instance. The list can be<br />filtered by instance, VNIC, or availability domain.<br /> |
attach | insert | region, instanceId, createVnicDetails | opc-retry-token | Creates a secondary VNIC and attaches it to the specified instance.<br />For more information about secondary VNICs, see<br />[Virtual Network Interface Cards (VNICs)](/iaas/Content/Network/Tasks/managingVNICs.htm).<br /> |
detach | delete | vnicAttachmentId, region | if-match | Detaches and deletes the specified secondary VNIC.<br />This operation cannot be used on the instance's primary VNIC.<br />When you terminate an instance, all attached VNICs (primary<br />and secondary) are automatically detached and deleted.<br /><br />Important: If the VNIC has a<br />[private IP](#/en/iaas/latest/PrivateIp/) that is the<br />[target of a route rule](/iaas/Content/Network/Tasks/managingroutetables.htm#privateip),<br />deleting the VNIC causes that route rule to blackhole and the traffic<br />will be dropped.<br /> |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
compartmentId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment. |
region | string | OCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION) |
vnicAttachmentId | string | The OCID of the VNIC attachment. |
availabilityDomain | string | The name of the availability domain. Example: Uocm:PHX-AD-1 |
if-match | string | For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value. |
instanceId | string | The OCID of the instance. |
limit | integer | For list pagination. The maximum number of results per page, or items to return in a paginated "List" call. For important details about how pagination works, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine). Example: 50 |
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). |
page | string | For list pagination. The value of the opc-next-page response header from the previous "List" call. For important details about how pagination works, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine). |
vnicId | string | The OCID of the VNIC. |
SELECT examples​
- get
- list
Gets the information for the specified VNIC attachment.<br />
SELECT
id,
availabilityDomain,
compartmentId,
displayName,
instanceId,
lifecycleState,
nicIndex,
subnetId,
timeCreated,
vlanId,
vlanTag,
vnicId
FROM oci.compute.vnic_attachments
WHERE vnicAttachmentId = '{{ vnicAttachmentId }}' -- required
AND region = '{{ region }}' -- required
;
Lists the VNIC attachments in the specified compartment. A VNIC attachment<br />resides in the same compartment as the attached instance. The list can be<br />filtered by instance, VNIC, or availability domain.<br />
SELECT
id,
availabilityDomain,
compartmentId,
displayName,
instanceId,
lifecycleState,
nicIndex,
subnetId,
timeCreated,
vlanId,
vlanTag,
vnicId
FROM oci.compute.vnic_attachments
WHERE compartmentId = '{{ compartmentId }}' -- required
AND region = '{{ region }}' -- required
AND availabilityDomain = '{{ availabilityDomain }}'
AND instanceId = '{{ instanceId }}'
AND limit = '{{ limit }}'
AND page = '{{ page }}'
AND vnicId = '{{ vnicId }}'
;
INSERT examples​
- attach
- Manifest
Creates a secondary VNIC and attaches it to the specified instance.<br />For more information about secondary VNICs, see<br />[Virtual Network Interface Cards (VNICs)](/iaas/Content/Network/Tasks/managingVNICs.htm).<br />
INSERT INTO oci.compute.vnic_attachments (
createVnicDetails,
displayName,
instanceId,
nicIndex,
region,
opc-retry-token
)
SELECT
'{{ createVnicDetails }}' /* required */,
'{{ displayName }}',
'{{ instanceId }}' /* required */,
{{ nicIndex }},
'{{ region }}',
'{{ opc-retry-token }}'
RETURNING
id,
availabilityDomain,
compartmentId,
displayName,
instanceId,
lifecycleState,
nicIndex,
subnetId,
timeCreated,
vlanId,
vlanTag,
vnicId
;
# Description fields are for documentation purposes
- name: vnic_attachments
props:
- name: region
value: "{{ region }}"
description: Required parameter for the vnic_attachments resource.
- name: createVnicDetails
description: |
Contains properties for a VNIC. You use this object when creating the
primary VNIC during instance launch or when creating a secondary VNIC.
For more information about VNICs, see
[Virtual Network Interface Cards (VNICs)](/iaas/Content/Network/Tasks/managingVNICs.htm).
value:
assignIpv6Ip: {{ assignIpv6Ip }}
assignPrivateDnsRecord: {{ assignPrivateDnsRecord }}
assignPublicIp: {{ assignPublicIp }}
definedTags: "{{ definedTags }}"
displayName: "{{ displayName }}"
freeformTags: "{{ freeformTags }}"
hostnameLabel: "{{ hostnameLabel }}"
ipv6AddressIpv6SubnetCidrPairDetails:
- ipv6Address: "{{ ipv6Address }}"
ipv6Id: "{{ ipv6Id }}"
ipv6SubnetCidr: "{{ ipv6SubnetCidr }}"
nsgIds:
- "{{ nsgIds }}"
privateIp: "{{ privateIp }}"
privateIpId: "{{ privateIpId }}"
securityAttributes: "{{ securityAttributes }}"
skipSourceDestCheck: {{ skipSourceDestCheck }}
subnetCidr: "{{ subnetCidr }}"
subnetId: "{{ subnetId }}"
vlanId: "{{ vlanId }}"
- name: displayName
value: "{{ displayName }}"
description: |
A user-friendly name. Does not have to be unique, and it's changeable.
Avoid entering confidential information.
- name: instanceId
value: "{{ instanceId }}"
description: |
The OCID of the instance.
- name: nicIndex
value: {{ nicIndex }}
description: |
Which physical network interface card (NIC) the VNIC will use. Defaults to 0.
Certain bare metal instance shapes have two active physical NICs (0 and 1). If
you add a secondary VNIC to one of these instances, you can specify which NIC
the VNIC will use. For more information, see
[Virtual Network Interface Cards (VNICs)](/iaas/Content/Network/Tasks/managingVNICs.htm).
- name: opc-retry-token
value: "{{ opc-retry-token }}"
description: 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).
description: 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).
DELETE examples​
- detach
Detaches and deletes the specified secondary VNIC.<br />This operation cannot be used on the instance's primary VNIC.<br />When you terminate an instance, all attached VNICs (primary<br />and secondary) are automatically detached and deleted.<br /><br />Important: If the VNIC has a<br />[private IP](#/en/iaas/latest/PrivateIp/) that is the<br />[target of a route rule](/iaas/Content/Network/Tasks/managingroutetables.htm#privateip),<br />deleting the VNIC causes that route rule to blackhole and the traffic<br />will be dropped.<br />
DELETE FROM oci.compute.vnic_attachments
WHERE vnicAttachmentId = '{{ vnicAttachmentId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match }}'
;