network_interface_attachments
Creates, updates, deletes or gets a network_interface_attachment resource or lists network_interface_attachments in a region
Overview
| Name | network_interface_attachments |
| Type | Resource |
| Description | Attaches an elastic network interface (ENI) to an Amazon EC2 instance. You can use this resource type to attach additional network interfaces to an instance without interruption. |
| Id | awscc.ec2.network_interface_attachments |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
attachment_id | string | |
delete_on_termination | boolean | Whether to delete the network interface when the instance terminates. By default, this value is set to true. |
device_index | string | The network interface's position in the attachment order. For example, the first attached network interface has a DeviceIndex of 0. |
instance_id | string | The ID of the instance to which you will attach the ENI. |
network_interface_id | string | The ID of the ENI that you want to attach. |
ena_srd_specification | object | Configures ENA Express for the network interface that this action attaches to the instance. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
attachment_id | string | |
region | string | AWS region. |
For more information, see AWS::EC2::NetworkInterfaceAttachment.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | network_interface_attachments | INSERT | DeviceIndex, InstanceId, NetworkInterfaceId, region |
delete_resource | network_interface_attachments | DELETE | Identifier, region |
update_resource | network_interface_attachments | UPDATE | Identifier, PatchDocument, region |
list_resources | network_interface_attachments_list_only | SELECT | region |
get_resource | network_interface_attachments | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual network_interface_attachment.
SELECT
region,
attachment_id,
delete_on_termination,
device_index,
instance_id,
network_interface_id,
ena_srd_specification
FROM awscc.ec2.network_interface_attachments
WHERE
region = '{{ region }}' AND
Identifier = '{{ attachment_id }}';
Lists all network_interface_attachments in a region.
SELECT
region,
attachment_id
FROM awscc.ec2.network_interface_attachments_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new network_interface_attachment resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ec2.network_interface_attachments (
DeviceIndex,
InstanceId,
NetworkInterfaceId,
region
)
SELECT
'{{ device_index }}',
'{{ instance_id }}',
'{{ network_interface_id }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.ec2.network_interface_attachments (
DeleteOnTermination,
DeviceIndex,
InstanceId,
NetworkInterfaceId,
EnaSrdSpecification,
region
)
SELECT
'{{ delete_on_termination }}',
'{{ device_index }}',
'{{ instance_id }}',
'{{ network_interface_id }}',
'{{ ena_srd_specification }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: network_interface_attachment
props:
- name: delete_on_termination
value: '{{ delete_on_termination }}'
- name: device_index
value: '{{ device_index }}'
- name: instance_id
value: '{{ instance_id }}'
- name: network_interface_id
value: '{{ network_interface_id }}'
- name: ena_srd_specification
value:
ena_srd_enabled: '{{ ena_srd_enabled }}'
ena_srd_udp_specification:
ena_srd_udp_enabled: '{{ ena_srd_udp_enabled }}'
UPDATE example
Use the following StackQL query and manifest file to update a network_interface_attachment resource, using stack-deploy.
/*+ update */
UPDATE awscc.ec2.network_interface_attachments
SET PatchDocument = string('{{ {
"DeleteOnTermination": delete_on_termination,
"EnaSrdSpecification": ena_srd_specification
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ attachment_id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.network_interface_attachments
WHERE
Identifier = '{{ attachment_id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the network_interface_attachments resource, the following permissions are required:
- Create
- Read
- List
- Update
- Delete
ec2:AttachNetworkInterface,
ec2:DescribeNetworkInterfaces,
ec2:ModifyNetworkInterfaceAttribute
ec2:DescribeNetworkInterfaces
ec2:DescribeNetworkInterfaces
ec2:ModifyNetworkInterfaceAttribute,
ec2:DescribeNetworkInterfaces,
ec2:AttachNetworkInterface,
ec2:DetachNetworkInterface
ec2:DetachNetworkInterface,
ec2:DescribeNetworkInterfaces