Search code examples
amazon-web-servicesamazon-ec2vpcelastic-load-balancer

aws elb doesn't work - connection timed out error


I created VPC with public and private subnets like this:

  • public subnet : bastion server, elastic load balancer, igw
  • private subnet : ec2 instance(app is running with http 8080 port), nat gateway

Following is the listeners config.

  • load balancer protocol : http
  • load balancer port : 80
  • instance protocol : http
  • instance port : 8080

When I try with the command 'wget -O - http://elb-xxxxx.us-west-2.elb.amazonaws.com', the result is

Resolving elb-xxxxx.us-west-2.elb.amazonaws.com (elb-xxxxx.us-west-2.elb.amazonaws.com)... 
52.x.x.x., 52.x.x.x, 54.x.x.x, ...
Connecting to elb-xxxxxx.us-west-2.elb.amazonaws.com (elb-xxxxxx.us-west-2.elb.amazonaws.com)|52.x.x.x|:80... 
failed: Connection timed out.

However, status of load balancer is 'inService' and elb's healthcheck is working!(elb is calling the app's api normally)

When I installed my app on the bastion server in the public subnet, I could access to the app with web broswer and it worked normally.

In sum, VPC and its routing configuration seem to be correct, and elb is also watching the instance correctly.

However, if I try to access to app through elb with elb's DNS name, connection timed out error occurs.

I am stuck in this and need help from you..


Solution

  • I found the problem by myself. I mistakenly added both public and private subnet to elb.. Thanks though..!