KurioZ7
KurioZ7

Reputation: 6349

How to test AWS Network Load Balancer using Curl command?

I have created an AWS Network Load Balancer, with TCP:80 (HTTP) listener. This listener forward requests to a Target Group called "My-TargetGroup."

I have created a Task Defintion, that points to a Docker Image of the Spring Boot service, that runs on port 8080. In ECS, When I created the ECS Service I selected "My-TargetGroup", with listener port at 80.

I can see that my ECS Service has one Task running successfully. However, I do not know how to test whether NLB is able to forward the request to the underlying spring boot service. For eg. in my Spring boot API, I have a the endpoint myapi/faq. How do I call this API through curl?. Basically, I will be calling this API end point as http/https method. So I want to now test this API as a get call through https protocol

Upvotes: 3

Views: 12087

Answers (2)

Adiii
Adiii

Reputation: 60046

Before curl, I will suggest making the sure thing on the infrastructure side, cur l will never help you to debug the issue. curl may work in your case but normally network Load balancer work on netwrok layer so you can try with telnet.

telnet lb_endpoint 80 

But what you need is to make sure is the target healthy?

enter image description here

So if the target is healthy application is running and LB should response and if not then check security group of LB.

If the target is unhealthy something wrong with ECS services so do need to debug LB.

Upvotes: 1

Juned Ahsan
Juned Ahsan

Reputation: 68715

You can try to use netcat command for a variety of connectivity tests. Here is the syntax

nc -v {host} {port}

With -v(verbose) option, you should ideally see an output if your server socket returns something on connection.

Upvotes: 1

Related Questions