-2

I am trying to hit a load balancer endpoint using AWS SDK for java, however I dont see any API for in the AmazonECSClient class. I see the option to set endpoint, region, credentials etc.

AmazonECSClient.builder()
  .withCredentials(new DefaultAWSCredentialsProviderChain())
  .withRegion(region)
  .withEndPoint()
  .build();

The endpoint is tested using curl command and it works - curl http://elb-dummy-endpoint.us-east-1.elb.domain.com:80/invocations -d '{"query": "some query"}' -H 'Content-Type: application/json'

Do I have to do a regular API call?

user2133404
  • 1,539
  • 4
  • 25
  • 53

1 Answers1

1

I am trying to hit a load balancer endpoint using AWS SDK for java

You would not use the AWS SDK for hitting a load balancer endpoint. The AWS SDK is for interacting with the AWS API for doing things like creating a load balancer. The load balancer is serving your API, not the AWS API, so you would not use the AWS SDK to interact with the load balancer.

The AmazonECSClient class you are trying to use is for doing things like creating/updating/deleting ECS clusters, services and tasks. It is not a client for the application you have running on ECS.

The endpoint is tested using curl command and it works - curl http://elb-dummy-endpoint.us-east-1.elb.domain.com:80/invocations -d '{"query": "some query"}' -H 'Content-Type: application/json'

You are testing it here with curl to make basic HTTP calls, you are not using the AWS CLI tool. In Java you would do the same thing, make a basic HTTP call against the endpoint.

Mark B
  • 139,343
  • 19
  • 240
  • 237