associate_dhcp_options
¶
associate_dhcp_options(
*,
config_overrides: Optional[EC2ClientConfig] = None,
dhcp_options_id: Optional[DefaultingDhcpOptionsId] = None,
vpc_id: Optional[VpcId] = None,
dry_run: Optional[Boolean] = None,
) -> None
Associates a set of DHCP options (that you've previously created) with the specified VPC, or associates no DHCP options with the VPC.
After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. You can explicitly renew the lease using the operating system on the instance.
For more information, see DHCP option sets in the Amazon VPC User Guide.
Parameters:
-
dhcp_options_id(Optional[DefaultingDhcpOptionsId], default:None) –The ID of the DHCP options set, or
defaultto associate no DHCP options with the VPC. -
vpc_id(Optional[VpcId], default:None) –The ID of the VPC.
-
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.
Examples:
To associate a DHCP options set with a VPC This example associates the specified DHCP options set with the specified VPC.
>>> client.associate_dhcp_options(dhcp_options_id='dopt-d9070ebb', vpc_id='vpc-a01106c2')
To associate the default DHCP options set with a VPC
This example associates the default DHCP options set with the specified VPC.
Source code in docs_src/capo_ec2/_services/ec2.py
4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 | |