create_network_interface
¶
create_network_interface(
*,
config_overrides: Optional[EC2ClientConfig] = None,
ipv4_prefixes: Optional[Ipv4PrefixList] = None,
ipv4_prefix_count: Optional[Integer] = None,
ipv6_prefixes: Optional[Ipv6PrefixList] = None,
ipv6_prefix_count: Optional[Integer] = None,
interface_type: Optional[NetworkInterfaceCreationType] = None,
tag_specifications: Optional[TagSpecificationList] = None,
client_token: Optional[String] = None,
enable_primary_ipv6: Optional[Boolean] = None,
connection_tracking_specification: Optional[
ConnectionTrackingSpecificationRequest
] = None,
operator: Optional[OperatorRequest] = None,
subnet_id: Optional[SubnetId] = None,
description: Optional[String] = None,
private_ip_address: Optional[String] = None,
groups: Optional[SecurityGroupIdStringList] = None,
private_ip_addresses: Optional[PrivateIpAddressSpecificationList] = None,
secondary_private_ip_address_count: Optional[Integer] = None,
ipv6_addresses: Optional[InstanceIpv6AddressList] = None,
ipv6_address_count: Optional[Integer] = None,
dry_run: Optional[Boolean] = None,
) -> CreateNetworkInterfaceResult
Creates a network interface in the specified subnet.
The number of IP addresses you can assign to a network interface varies by instance type.
For more information about network interfaces, see Elastic network interfaces in the Amazon EC2 User Guide.
Parameters:
-
ipv4_prefixes(Optional[Ipv4PrefixList], default:None) –The IPv4 prefixes assigned to the network interface.
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(Optional[Integer], default:None) –The number of IPv4 prefixes that Amazon Web Services automatically assigns to the network interface.
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.
-
ipv6_prefixes(Optional[Ipv6PrefixList], default:None) –The IPv6 prefixes assigned to the network interface.
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.
-
ipv6_prefix_count(Optional[Integer], default:None) –The number of IPv6 prefixes that Amazon Web Services automatically assigns to the network interface.
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.
-
interface_type(Optional[NetworkInterfaceCreationType], default:None) –The type of network interface. The default is
interface.If you specify
efa-only, do not assign any IP addresses to the network interface. EFA-only network interfaces do not support IP addresses.The only supported values are
interface,efa,efa-only, andtrunk. -
tag_specifications(Optional[TagSpecificationList], default:None) –The tags to apply to the new network interface.
-
client_token(Optional[String], default:None) –Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.
-
enable_primary_ipv6(Optional[Boolean], default:None) –If you’re creating a network interface in a dual-stack or IPv6-only subnet, you have the option to assign a primary IPv6 IP address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if the instance that this ENI will be attached to relies on its IPv6 address not changing. Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.
-
connection_tracking_specification(Optional[ConnectionTrackingSpecificationRequest], default:None) –A connection tracking specification for the network interface.
-
operator(Optional[OperatorRequest], default:None) –Reserved for internal use.
-
subnet_id(Optional[SubnetId], default:None) –The ID of the subnet to associate with the network interface.
-
description(Optional[String], default:None) –A description for the network interface.
-
private_ip_address(Optional[String], default:None) –The primary private IPv4 address of the network interface. If you don't specify an IPv4 address, Amazon EC2 selects one for you from the subnet's IPv4 CIDR range. If you specify an IP address, you cannot indicate any IP addresses specified in
privateIpAddressesas primary (only one IP address can be designated as primary). -
groups(Optional[SecurityGroupIdStringList], default:None) –The IDs of the security groups.
-
private_ip_addresses(Optional[PrivateIpAddressSpecificationList], default:None) –The private IPv4 addresses.
You can't specify private IPv4 addresses if you've specified one of the following: a count of private IPv4 addresses, specific IPv4 prefixes, or a count of IPv4 prefixes.
-
secondary_private_ip_address_count(Optional[Integer], default:None) –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.You can't specify a count of private IPv4 addresses if you've specified one of the following: specific private IPv4 addresses, specific IPv4 prefixes, or a count of IPv4 prefixes.
-
ipv6_addresses(Optional[InstanceIpv6AddressList], default:None) –The IPv6 addresses from the IPv6 CIDR block range of your subnet.
You can't specify IPv6 addresses using this parameter if you've specified one of the following: a count of IPv6 addresses, specific IPv6 prefixes, or a count of IPv6 prefixes.
-
ipv6_address_count(Optional[Integer], default:None) –The number of IPv6 addresses to assign to a network interface. Amazon EC2 automatically selects the IPv6 addresses from the subnet range.
You can't specify a count of IPv6 addresses using this parameter if you've specified one of the following: specific IPv6 addresses, specific IPv6 prefixes, or a count of IPv6 prefixes.
If your subnet has the
AssignIpv6AddressOnCreationattribute set, you can override that setting by specifying 0 as the IPv6 address count. -
dry_run(Optional[Boolean], default:None) –Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ec2/_services/ec2.py
11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 | |