modify_network_interface_attribute
async
¶
modify_network_interface_attribute(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = 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.
>>> await 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.
>>> await 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.
>>> await 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.
>>> await client.modify_network_interface_attribute(network_interface_id='eni-686ea200', source_dest_check={'Value': False})
Source code in docs_src/capo_ec2/_services/async_ec2.py
52667 52668 52669 52670 52671 52672 52673 52674 52675 52676 52677 52678 52679 52680 52681 52682 52683 52684 52685 52686 52687 52688 52689 52690 52691 52692 52693 52694 52695 52696 52697 52698 52699 52700 52701 52702 52703 52704 52705 52706 52707 52708 52709 52710 52711 52712 52713 52714 52715 52716 52717 52718 52719 52720 52721 52722 52723 52724 52725 52726 52727 52728 52729 52730 52731 52732 52733 52734 52735 52736 52737 52738 52739 52740 52741 52742 52743 52744 52745 52746 52747 52748 52749 52750 52751 52752 52753 52754 52755 52756 52757 52758 52759 52760 52761 52762 52763 52764 52765 52766 52767 52768 52769 52770 52771 52772 52773 52774 52775 52776 52777 52778 52779 52780 52781 52782 | |