question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@aws-cdk/aws_elasticloadbalancingv2-CfnTargetGroup:: Not able to add *target_group_attributes*

See original GitHub issue

General Issue

target_group_attributes create/update fails

The Question

I’m trying to create a Loadbalancer for already existing instances, with CfnTargetGroup and enabling the target_group_attributes(https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_elasticloadbalancingv2/CfnTargetGroup.html#aws_cdk.aws_elasticloadbalancingv2.CfnTargetGroup.target_group_attributes).

        target_groups = lbv2.CfnTargetGroup (self, "target_group",
                                            name = config.target_groups.name + environment,
                                            port = config.target_groups.port,
                                            protocol = config.target_groups.protocol,
                                            protocol_version = config.target_groups.protocol_version,
                                            target_type = "instance",
                                            targets = [targets],
                                            vpc_id=vpc.vpc_id,
                                            health_check_enabled = True,
                                            health_check_interval_seconds = 5,
                                            matcher = {"HttpCode" :"200"} ,        # Validate the LB health 
                                            target_group_attributes = [{"Key":"stickiness.enabled" , "Value" : "true"}]

This is the error I’m getting, not sure what am I missing here


EC2Stackdevelopment: creating CloudFormation changeset...
11:09:02 AM | UPDATE_FAILED        | AWS::ElasticLoadBalancingV2::TargetGroup  | targetgroup
1 validation error detected: Value null at 'attributes' failed to satisfy constraint: Member must not be null (Service: AmazonElasticLoadBalancing; Status Code: 400; Error Code: ValidationError; Request ID: 21a19d89-8942-4a11-b4ee-5cbbf6a5452e; Proxy: null)

	/private/var/folders/19/mv6krhlx2lndqhy71b88zhxc0000gn/T/tmprk9fhl1_/lib/program.js:8367:58

CDK CLI Version

1.126.0 (build f004e1a)

Framework Version

No response

Node.js Version

No response

OS

mac

Language

Python

Language Version

Python 3.9.7

Other information

If I enable all of them

target_group_attributes = [{"Key":"stickiness.enabled" , "Value" : "true"},{"Key":"stickiness.type" , "Value" : "lb_cookie"},{"Key":"slow_start.duration_seconds" , "Value" : "0"},{"Key":"stickiness.lb_cookie.duration_seconds" , "Value" : "86400"},{"Key":"load_balancing.algorithm.type" , "Value" : "round_robin"}]

I’m getting below error

 9:47:57 AM | CREATE_FAILED        | AWS::ElasticLoadBalancingV2::TargetGroup  | targetgroup
Property TargetGroupAttributes contains duplicate values.

There is no duplicate value i can find in them

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ns-ajithcommented, Oct 7, 2021

Ahhh that makes sense and thank you so much for explaining it with examples. Really appreciated.

0reactions
github-actions[bot]commented, Oct 7, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::ElasticLoadBalancingV2::TargetGroup
If the protocol of the target group is TCP, TLS, UDP, or TCP_UDP, you can't modify the health check protocol, interval, timeout, or...
Read more >
modify-target-group-attributes — AWS CLI 2.9.8 Command ...
The possible values are rebalance and no_rebalance . The default is no_rebalance . The two attributes ( target_failover.on_deregistration and target_failover.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found