modify_network_interface_attribute
¶
modify_network_interface_attribute(
*,
config_overrides: Optional[EC2ClientConfig] = None,
ena_srd_specification: Optional[EnaSrdSpecification] = None,
enable_primary_ipv6: Optional[Boolean] = None,
connection_tracking_specification: Optional[
ConnectionTrackingSpecificationRequest
] = None,
associate_public_ip_address: Optional[Boolean] = None,
associated_subnet_ids: Optional[SubnetIdList] = None,
dry_run: Optional[Boolean] = None,
network_interface_id: Optional[NetworkInterfaceId] = None,
description: Optional[AttributeValue] = None,
source_dest_check: Optional[AttributeBooleanValue] = None,
groups: Optional[SecurityGroupIdStringList] = None,
attachment: Optional[NetworkInterfaceAttachmentChanges] = None,
) -> None
Modifies the specified network interface attribute. You can specify only one attribute at a time. You can use this action to attach and detach security groups from an existing EC2 instance.
Parameters:
-
ena_srd_specification(Optional[EnaSrdSpecification], default:None) –Updates the ENA Express configuration for the network interface that’s attached to the instance.
-
enable_primary_ipv6(Optional[Boolean], default:None) –If you’re modifying 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.
-
associate_public_ip_address(Optional[Boolean], default:None) –Indicates whether to assign a public IPv4 address to a network interface. This option can be enabled for any network interface but will only apply to the primary network interface (eth0).
-
associated_subnet_ids(Optional[SubnetIdList], default:None) –A list of subnet IDs to associate with the network interface.
-
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. -
network_interface_id(Optional[NetworkInterfaceId], default:None) –The ID of the network interface.
-
description(Optional[AttributeValue], default:None) –A description for the network interface.
-
source_dest_check(Optional[AttributeBooleanValue], default:None) –Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is
true, source/destination checks are enabled; otherwise, they are disabled. The default value istrue. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls. -
groups(Optional[SecurityGroupIdStringList], default:None) –Changes the security groups for the network interface. The new set of groups you specify replaces the current set. You must specify at least one group, even if it's just the default security group in the VPC. You must specify the ID of the security group, not the name.
-
attachment(Optional[NetworkInterfaceAttachmentChanges], default:None) –Information about the interface attachment. If modifying the
delete on terminationattribute, you must specify the ID of the interface attachment.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To modify the attachment attribute of a network interface This example modifies the attachment attribute of the specified network interface.
>>> client.modify_network_interface_attribute(network_interface_id='eni-686ea200', attachment={'AttachmentId': 'eni-attach-43348162', 'DeleteOnTermination': False})
To modify the description attribute of a network interface
This example modifies the description attribute of the specified network interface.
>>> client.modify_network_interface_attribute(network_interface_id='eni-686ea200', description={'Value': 'My description'})
To modify the groupSet attribute of a network interface
This example command modifies the groupSet attribute of the specified network interface.
>>> client.modify_network_interface_attribute(network_interface_id='eni-686ea200', groups=['sg-903004f8', 'sg-1a2b3c4d'])
To modify the sourceDestCheck attribute of a network interface
This example command modifies the sourceDestCheck attribute of the specified network interface.
>>> client.modify_network_interface_attribute(network_interface_id='eni-686ea200', source_dest_check={'Value': False})
Source code in docs_src/capo_ec2/_services/ec2.py
51944 51945 51946 51947 51948 51949 51950 51951 51952 51953 51954 51955 51956 51957 51958 51959 51960 51961 51962 51963 51964 51965 51966 51967 51968 51969 51970 51971 51972 51973 51974 51975 51976 51977 51978 51979 51980 51981 51982 51983 51984 51985 51986 51987 51988 51989 51990 51991 51992 51993 51994 51995 51996 51997 51998 51999 52000 52001 52002 52003 52004 52005 52006 52007 52008 52009 52010 52011 52012 52013 52014 52015 52016 52017 52018 52019 52020 52021 52022 52023 52024 52025 52026 52027 52028 52029 52030 52031 52032 52033 52034 52035 52036 52037 52038 52039 52040 52041 52042 52043 52044 52045 52046 52047 52048 52049 52050 52051 52052 52053 52054 52055 52056 52057 52058 | |