The process in my application through AWS API - AmazonElasticLoadBalancingV2Client, that I am trying to achieve is:
- Create Target Group
- Register Target in Target Group
- Register / Add Target Group to Load Balancer.
First 2 points works fine and results are visible in EC2 console correctly.
Unfortunately, I am not able to add TargetGroup to LoadBalancer.
The code I use is:
DescribeTargetGroupsRequest dtgr= new DescribeTargetGroupsRequest
{
TargetGroupArns = new List<string> { targetGroupArn },
LoadBalancerArn = loadBalancerArn
};
amazonElbClient.DescribeTargetGroups(dtgr);
//where:
//loadBalancerArn - correct, existing Load Balancer ARN,
//targetGroupArn - correct, existing Target Group
I am receiving the following error when executing DescribeTargetGroups:
Target group names, target group ARNs, and a load balancer ARN cannot be specified at the same time
I was also trying to use Names instead of Target Group ARNs, but the result is the same in any configuration of parameters.
How can I assign the Target Group to Load Balanacer?
Every help will be much appreciated.