modify_subnet_attribute
¶
modify_subnet_attribute(
*,
config_overrides: Optional[EC2ClientConfig] = None,
assign_ipv6_address_on_creation: Optional[AttributeBooleanValue] = None,
map_public_ip_on_launch: Optional[AttributeBooleanValue] = None,
subnet_id: Optional[SubnetId] = None,
map_customer_owned_ip_on_launch: Optional[AttributeBooleanValue] = None,
customer_owned_ipv4_pool: Optional[CoipPoolId] = None,
enable_dns64: Optional[AttributeBooleanValue] = None,
private_dns_hostname_type_on_launch: Optional[HostnameType] = None,
enable_resource_name_dns_a_record_on_launch: Optional[AttributeBooleanValue] = None,
enable_resource_name_dns_aaaa_record_on_launch: Optional[
AttributeBooleanValue
] = None,
enable_lni_at_device_index: Optional[Integer] = None,
disable_lni_at_device_index: Optional[AttributeBooleanValue] = None,
) -> None
Modifies a subnet attribute. You can only modify one attribute at a time.
Use this action to modify subnets on Amazon Web Services Outposts.
-
To modify a subnet on an Outpost rack, set both
MapCustomerOwnedIpOnLaunchandCustomerOwnedIpv4Pool. These two parameters act as a single attribute. -
To modify a subnet on an Outpost server, set either
EnableLniAtDeviceIndexorDisableLniAtDeviceIndex.
For more information about Amazon Web Services Outposts, see the following:
Parameters:
-
assign_ipv6_address_on_creation(Optional[AttributeBooleanValue], default:None) –Specify
trueto indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. This includes a network interface that's created when launching an instance into the subnet (the instance therefore receives an IPv6 address).If you enable the IPv6 addressing feature for your subnet, your network interface or instance only receives an IPv6 address if it's created using version
2016-11-15or later of the Amazon EC2 API. -
map_public_ip_on_launch(Optional[AttributeBooleanValue], default:None) –Specify
trueto indicate that network interfaces attached to instances created in the specified subnet should be assigned a public IPv4 address.Amazon Web Services charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the Amazon VPC pricing page.
-
subnet_id(Optional[SubnetId], default:None) –The ID of the subnet.
-
map_customer_owned_ip_on_launch(Optional[AttributeBooleanValue], default:None) –Specify
trueto indicate that network interfaces attached to instances created in the specified subnet should be assigned a customer-owned IPv4 address.When this value is
true, you must specify the customer-owned IP pool usingCustomerOwnedIpv4Pool. -
customer_owned_ipv4_pool(Optional[CoipPoolId], default:None) –The customer-owned IPv4 address pool associated with the subnet.
You must set this value when you specify
trueforMapCustomerOwnedIpOnLaunch. -
enable_dns64(Optional[AttributeBooleanValue], default:None) –Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a
0.0.0.0/0route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the Amazon VPC User Guide. -
private_dns_hostname_type_on_launch(Optional[HostnameType], default:None) –The type of hostname to assign to instances in the subnet at launch. For IPv4-only and dual-stack (IPv4 and IPv6) subnets, an instance DNS name can be based on the instance IPv4 address (ip-name) or the instance ID (resource-name). For IPv6 only subnets, an instance DNS name must be based on the instance ID (resource-name).
-
enable_resource_name_dns_a_record_on_launch(Optional[AttributeBooleanValue], default:None) –Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
-
enable_resource_name_dns_aaaa_record_on_launch(Optional[AttributeBooleanValue], default:None) –Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records.
-
enable_lni_at_device_index(Optional[Integer], default:None) –Indicates the device position for local network interfaces in this subnet. For example,
1indicates local network interfaces in this subnet are the secondary network interface (eth1). A local network interface cannot be the primary network interface (eth0). -
disable_lni_at_device_index(Optional[AttributeBooleanValue], default:None) –Specify
trueto indicate that local network interfaces at the current position should be disabled.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To change a subnet's public IP addressing behavior This example modifies the specified subnet so that all instances launched into this subnet are assigned a public IP address.
>>> client.modify_subnet_attribute(subnet_id='subnet-1a2b3c4d', map_public_ip_on_launch={'Value': True})
Source code in docs_src/capo_ec2/_services/ec2.py
52578 52579 52580 52581 52582 52583 52584 52585 52586 52587 52588 52589 52590 52591 52592 52593 52594 52595 52596 52597 52598 52599 52600 52601 52602 52603 52604 52605 52606 52607 52608 52609 52610 52611 52612 52613 52614 52615 52616 52617 52618 52619 52620 52621 52622 52623 52624 52625 52626 52627 52628 52629 52630 52631 52632 52633 52634 52635 52636 52637 52638 52639 52640 52641 52642 52643 52644 52645 52646 52647 52648 52649 52650 52651 52652 52653 52654 52655 52656 52657 52658 52659 52660 52661 52662 52663 52664 52665 52666 52667 52668 52669 52670 52671 52672 52673 52674 52675 52676 52677 52678 52679 52680 52681 52682 52683 52684 52685 52686 52687 52688 | |