modify_load_balancer_attributes
¶
modify_load_balancer_attributes(
*,
config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
load_balancer_arn: Optional[LoadBalancerArn] = None,
attributes: Optional[LoadBalancerAttributes] = None,
) -> ModifyLoadBalancerAttributesOutput
Modifies the specified attributes of the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.
If any of the specified attributes can't be modified as requested, the call fails. Any existing attributes that you do not modify retain their current values.
Parameters:
-
load_balancer_arn(Optional[LoadBalancerArn], default:None) –The Amazon Resource Name (ARN) of the load balancer.
-
attributes(Optional[LoadBalancerAttributes], default:None) –The load balancer attributes.
Raises:
-
InvalidConfigurationRequestException–The requested configuration is not valid.
-
LoadBalancerNotFoundException–The specified load balancer does not exist.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To enable deletion protection This example enables deletion protection for the specified load balancer.
>>> client.modify_load_balancer_attributes(load_balancer_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188', attributes=[{'Key': 'deletion_protection.enabled', 'Value': 'true'}])
To change the idle timeout
This example changes the idle timeout value for the specified load balancer.
>>> client.modify_load_balancer_attributes(load_balancer_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188', attributes=[{'Key': 'idle_timeout.timeout_seconds', 'Value': '30'}])
To enable access logs
This example enables access logs for the specified load balancer. Note that the S3 bucket must exist in the same region as the load balancer and must have a policy attached that grants access to the Elastic Load Balancing service.
>>> client.modify_load_balancer_attributes(load_balancer_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188', attributes=[{'Key': 'access_logs.s3.enabled', 'Value': 'true'}, {'Key': 'access_logs.s3.bucket', 'Value': 'my-loadbalancer-logs'}, {'Key': 'access_logs.s3.prefix', 'Value': 'myapp'}])
Source code in docs_src/capo_elastic_load_balancing_v2/_services/elastic_load_balancingv2.py
3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 | |