Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29543

How to attach Amazon EC2 Target Group to Amazon Elastic Load Balancer using AWS API

$
0
0

The process in my application through AWS API - AmazonElasticLoadBalancingV2Client, that I am trying to achieve is:

  1. Create Target Group
  2. Register Target in Target Group
  3. 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.


Viewing all articles
Browse latest Browse all 29543

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>