set_security_groups
¶
set_security_groups(
*,
config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
load_balancer_arn: Optional[LoadBalancerArn] = None,
security_groups: Optional[SecurityGroups] = None,
enforce_security_group_inbound_rules_on_private_link_traffic: Optional[
EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum
] = None,
) -> SetSecurityGroupsOutput
Associates the specified security groups with the specified Application Load Balancer or Network Load Balancer. The specified security groups override the previously associated security groups.
You can't perform this operation on a Network Load Balancer unless you specified a security group for the load balancer when you created it.
You can't associate a security group with a Gateway Load Balancer.
Parameters:
-
load_balancer_arn(Optional[LoadBalancerArn], default:None) –The Amazon Resource Name (ARN) of the load balancer.
-
security_groups(Optional[SecurityGroups], default:None) –The IDs of the security groups.
-
enforce_security_group_inbound_rules_on_private_link_traffic(Optional[EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum], default:None) –Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through Amazon Web Services PrivateLink. Applies only if the load balancer has an associated security group. The default is
on.
Raises:
-
InvalidConfigurationRequestException–The requested configuration is not valid.
-
InvalidSecurityGroupException–The specified security group does not exist.
-
LoadBalancerNotFoundException–The specified load balancer does not exist.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To associate a security group with a load balancer This example associates the specified security group with the specified load balancer.
>>> client.set_security_groups(load_balancer_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188', security_groups=['sg-5943793c'])
Source code in docs_src/capo_elastic_load_balancing_v2/_services/elastic_load_balancingv2.py
3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 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 | |