network_interfaces
Creates, updates, deletes or gets a network_interface resource or lists network_interfaces in a region
Overview
| Name | network_interfaces |
| Type | Resource |
| Description | The AWS::EC2::NetworkInterface resource creates network interface |
| Id | awscc.ec2.network_interfaces |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
description | string | A description for the network interface. |
private_ip_address | string | Assigns a single private IP address to the network interface, which is used as the primary private IP address. If you want to specify multiple private IP address, use the PrivateIpAddresses property. |
primary_ipv6_address | string | The primary IPv6 address |
private_ip_addresses | array | Assigns a list of private IP addresses to the network interface. You can specify a primary private IP address by setting the value of the Primary property to true in the PrivateIpAddressSpecification property. If you want EC2 to automatically assign private IP addresses, use the SecondaryPrivateIpAddressCount property and do not specify this property. |
secondary_private_ip_address_count | integer | The number of secondary private IPv4 addresses to assign to a network interface. When you specify a number of secondary IPv4 addresses, Amazon EC2 selects these IP addresses within the subnet's IPv4 CIDR range. You can't specify this option and specify more than one private IP address using privateIpAddresses |
ipv6_prefix_count | integer | The number of IPv6 prefixes to assign to a network interface. When you specify a number of IPv6 prefixes, Amazon EC2 selects these prefixes from your existing subnet CIDR reservations, if available, or from free spaces in the subnet. By default, these will be /80 prefixes. You can't specify a count of IPv6 prefixes if you've specified one of the following: specific IPv6 prefixes, specific IPv6 addresses, or a count of IPv6 addresses. |
primary_private_ip_address | string | Returns the primary private IP address of the network interface. |
ipv4_prefixes | array | Assigns a list of IPv4 prefixes to the network interface. If you want EC2 to automatically assign IPv4 prefixes, use the Ipv4PrefixCount property and do not specify this property. Presently, only /28 prefixes are supported. You can't specify IPv4 prefixes if you've specified one of the following: a count of IPv4 prefixes, specific private IPv4 addresses, or a count of private IPv4 addresses. |
ipv4_prefix_count | integer | The number of IPv4 prefixes to assign to a network interface. When you specify a number of IPv4 prefixes, Amazon EC2 selects these prefixes from your existing subnet CIDR reservations, if available, or from free spaces in the subnet. By default, these will be /28 prefixes. You can't specify a count of IPv4 prefixes if you've specified one of the following: specific IPv4 prefixes, specific private IPv4 addresses, or a count of private IPv4 addresses. |
enable_primary_ipv6 | boolean | If you have instances or ENIs that rely on the IPv6 address not changing, to avoid disrupting traffic to instances or ENIs, you can enable a primary IPv6 address. Enable this option to automatically assign an IPv6 associated with the ENI attached to your instance to be the primary IPv6 address. When you enable an IPv6 address to be a primary IPv6, you cannot disable it. Traffic will be routed to the primary IPv6 address until the instance is terminated or the ENI is detached. If you have multiple IPv6 addresses associated with an ENI and you enable a primary IPv6 address, the first IPv6 address associated with the ENI becomes the primary IPv6 address. |
group_set | array | A list of security group IDs associated with this network interface. |
ipv6_addresses | array | One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet to associate with the network interface. If you're specifying a number of IPv6 addresses, use the Ipv6AddressCount property and don't specify this property. |
ipv6_prefixes | array | Assigns a list of IPv6 prefixes to the network interface. If you want EC2 to automatically assign IPv6 prefixes, use the Ipv6PrefixCount property and do not specify this property. Presently, only /80 prefixes are supported. You can't specify IPv6 prefixes if you've specified one of the following: a count of IPv6 prefixes, specific IPv6 addresses, or a count of IPv6 addresses. |
subnet_id | string | The ID of the subnet to associate with the network interface. |
source_dest_check | boolean | Indicates whether traffic to or from the instance is validated. |
interface_type | string | Indicates the type of network interface. |
secondary_private_ip_addresses | array | Returns the secondary private IP addresses of the network interface. |
vpc_id | string | The ID of the VPC |
ipv6_address_count | integer | The number of IPv6 addresses to assign to a network interface. Amazon EC2 automatically selects the IPv6 addresses from the subnet range. To specify specific IPv6 addresses, use the Ipv6Addresses property and don't specify this property. |
id | string | Network interface id. |
tags | array | An arbitrary set of tags (key-value pairs) for this network interface. |
connection_tracking_specification | object | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
id | string | Network interface id. |
region | string | AWS region. |
For more information, see AWS::EC2::NetworkInterface.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | network_interfaces | INSERT | SubnetId, region |
delete_resource | network_interfaces | DELETE | Identifier, region |
update_resource | network_interfaces | UPDATE | Identifier, PatchDocument, region |
list_resources | network_interfaces_list_only | SELECT | region |
get_resource | network_interfaces | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual network_interface.
SELECT
region,
description,
private_ip_address,
primary_ipv6_address,
private_ip_addresses,
secondary_private_ip_address_count,
ipv6_prefix_count,
primary_private_ip_address,
ipv4_prefixes,
ipv4_prefix_count,
enable_primary_ipv6,
group_set,
ipv6_addresses,
ipv6_prefixes,
subnet_id,
source_dest_check,
interface_type,
secondary_private_ip_addresses,
vpc_id,
ipv6_address_count,
id,
tags,
connection_tracking_specification
FROM awscc.ec2.network_interfaces
WHERE
region = 'us-east-1' AND
Identifier = '{{ id }}';
Lists all network_interfaces in a region.
SELECT
region,
id
FROM awscc.ec2.network_interfaces_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new network_interface resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ec2.network_interfaces (
SubnetId,
region
)
SELECT
'{{ subnet_id }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.ec2.network_interfaces (
Description,
PrivateIpAddress,
PrivateIpAddresses,
SecondaryPrivateIpAddressCount,
Ipv6PrefixCount,
Ipv4Prefixes,
Ipv4PrefixCount,
EnablePrimaryIpv6,
GroupSet,
Ipv6Addresses,
Ipv6Prefixes,
SubnetId,
SourceDestCheck,
InterfaceType,
Ipv6AddressCount,
Tags,
ConnectionTrackingSpecification,
region
)
SELECT
'{{ description }}',
'{{ private_ip_address }}',
'{{ private_ip_addresses }}',
'{{ secondary_private_ip_address_count }}',
'{{ ipv6_prefix_count }}',
'{{ ipv4_prefixes }}',
'{{ ipv4_prefix_count }}',
'{{ enable_primary_ipv6 }}',
'{{ group_set }}',
'{{ ipv6_addresses }}',
'{{ ipv6_prefixes }}',
'{{ subnet_id }}',
'{{ source_dest_check }}',
'{{ interface_type }}',
'{{ ipv6_address_count }}',
'{{ tags }}',
'{{ connection_tracking_specification }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: network_interface
props:
- name: description
value: '{{ description }}'
- name: private_ip_address
value: '{{ private_ip_address }}'
- name: private_ip_addresses
value:
- primary: '{{ primary }}'
private_ip_address: '{{ private_ip_address }}'
- name: secondary_private_ip_address_count
value: '{{ secondary_private_ip_address_count }}'
- name: ipv6_prefix_count
value: '{{ ipv6_prefix_count }}'
- name: ipv4_prefixes
value:
- ipv4_prefix: '{{ ipv4_prefix }}'
- name: ipv4_prefix_count
value: '{{ ipv4_prefix_count }}'
- name: enable_primary_ipv6
value: '{{ enable_primary_ipv6 }}'
- name: group_set
value:
- '{{ group_set[0] }}'
- name: ipv6_addresses
value:
- ipv6_address: '{{ ipv6_address }}'
- name: ipv6_prefixes
value:
- ipv6_prefix: '{{ ipv6_prefix }}'
- name: subnet_id
value: '{{ subnet_id }}'
- name: source_dest_check
value: '{{ source_dest_check }}'
- name: interface_type
value: '{{ interface_type }}'
- name: ipv6_address_count
value: '{{ ipv6_address_count }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
- name: connection_tracking_specification
value:
udp_timeout: '{{ udp_timeout }}'
tcp_established_timeout: '{{ tcp_established_timeout }}'
udp_stream_timeout: '{{ udp_stream_timeout }}'
UPDATE example
Use the following StackQL query and manifest file to update a network_interface resource, using stack-deploy.
/*+ update */
UPDATE awscc.ec2.network_interfaces
SET PatchDocument = string('{{ {
"Description": description,
"PrivateIpAddresses": private_ip_addresses,
"SecondaryPrivateIpAddressCount": secondary_private_ip_address_count,
"Ipv6PrefixCount": ipv6_prefix_count,
"Ipv4Prefixes": ipv4_prefixes,
"Ipv4PrefixCount": ipv4_prefix_count,
"EnablePrimaryIpv6": enable_primary_ipv6,
"GroupSet": group_set,
"Ipv6Addresses": ipv6_addresses,
"Ipv6Prefixes": ipv6_prefixes,
"SourceDestCheck": source_dest_check,
"Ipv6AddressCount": ipv6_address_count,
"Tags": tags,
"ConnectionTrackingSpecification": connection_tracking_specification
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}';
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.network_interfaces
WHERE
Identifier = '{{ id }}' AND
region = 'us-east-1';
Permissions
To operate on the network_interfaces resource, the following permissions are required:
- Read
- Create
- Update
- List
- Delete
ec2:DescribeNetworkInterfaces
ec2:CreateNetworkInterface,
ec2:DescribeNetworkInterfaces,
ec2:CreateTags,
ec2:ModifyNetworkInterfaceAttribute,
ec2:ModifyPublicIpDnsNameOptions
ec2:DescribeNetworkInterfaces,
ec2:ModifyNetworkInterfaceAttribute,
ec2:UnassignIpv6Addresses,
ec2:AssignIpv6Addresses,
ec2:DeleteTags,
ec2:CreateTags,
ec2:UnassignPrivateIpAddresses,
ec2:AssignPrivateIpAddresses,
ec2:ModifyPublicIpDnsNameOptions
ec2:DescribeNetworkInterfaces
ec2:DescribeNetworkInterfaces,
ec2:DeleteNetworkInterface