Lisa Hou
Lisa Hou

Reputation: 11

Is there a method to add Target Group to LoadBalancer?

I'm trying to launch an application load balancer from java sdk. I noticed that I can add "Target Group" in "Step 4: Configure Routing" through the console but I don't know how to add a target group through code. There seems to be not function like "withTargetGroup".

I just can't find the right documentation which can show me some functions that I can try.

CreateLoadBalancerRequest request = new CreateLoadBalancerRequest().withTargetGroup(group_name);

Upvotes: 1

Views: 1016

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269340

Use createListener().withDefaultActions()

It looks like you'll need to setTargetGroupArn and setType as forward.

See a similar answer related to Python: How to create and attach a ELB properly in Boto3

Upvotes: 1

Related Questions