View a markdown version of this page

Use ModifyTargetGroupAttributes with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use ModifyTargetGroupAttributes with a CLI

The following code examples show how to use ModifyTargetGroupAttributes.

CLI
AWS CLI

To modify the deregistration delay timeout

The following modify-target-group-attributes example sets the deregistration delay timeout to the specified value for the specified target group.

aws elbv2 modify-target-group-attributes \ --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \ --attributes Key=deregistration_delay.timeout_seconds,Value=600

Output:

{ "Attributes": [ { "Value": "false", "Key": "stickiness.enabled" }, { "Value": "600", "Key": "deregistration_delay.timeout_seconds" }, { "Value": "lb_cookie", "Key": "stickiness.type" }, { "Value": "86400", "Key": "stickiness.lb_cookie.duration_seconds" } ] }

For more information, see Edit target group attributes for your Application Load Balancer in the Application Load Balancers Guide.

PowerShell
Tools for PowerShell V4

Example 1: This example modifies the deregistration_delay attribute of the specified Target Group.

Edit-ELB2TargetGroupAttribute -TargetGroupArn 'arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/test-tg/a4e04b3688be1970' -Attribute @{Key = 'deregistration_delay.timeout_seconds'; Value = 600}

Output:

Key Value --- ----- stickiness.enabled false deregistration_delay.timeout_seconds 600 stickiness.type lb_cookie stickiness.lb_cookie.duration_seconds 86400 slow_start.duration_seconds 0 load_balancing.algorithm.type round_robin
Tools for PowerShell V5

Example 1: This example modifies the deregistration_delay attribute of the specified Target Group.

Edit-ELB2TargetGroupAttribute -TargetGroupArn 'arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/test-tg/a4e04b3688be1970' -Attribute @{Key = 'deregistration_delay.timeout_seconds'; Value = 600}

Output:

Key Value --- ----- stickiness.enabled false deregistration_delay.timeout_seconds 600 stickiness.type lb_cookie stickiness.lb_cookie.duration_seconds 86400 slow_start.duration_seconds 0 load_balancing.algorithm.type round_robin