user824624
user824624

Reputation: 8080

using amazon ec2 and binding the IP with instance, but not working

I am new to the amazon service, I have installed the node.js and mongodb on the amazon EC2, it all worked on the server side, however, when I wanted to test it, I binded the server instance with IP address, but visiting the server was not successful, I wanted to know what was wrong with it

Upvotes: 2

Views: 2377

Answers (1)

Chris Cooper
Chris Cooper

Reputation: 5122

You need to make sure your security group has the right ports open.

To do this, do the following:

  1. Select "Security Groups" in the "NETWORK & SECURITY" section on the left side of the screen.
  2. Select the security group you have assigned to your EC2 instance.
  3. Select the "Inbound" tab in the bottom panel.
  4. Add the port you want to open and the range of addresses that can access it.

For example add this:

Port range: 80
Source:     0.0.0.0/0

In order to open the standard port for HTTP from any IP address.

If you are using a load balancer you will also need to open the port there too:

  1. Select "Load Balancers" in the "NETWORK & SECURITY" section on the left side of the screen.
  2. Select the Load balancer pointing to your EC2 instance.
  3. Select the "Listeners" tab in the bottom panel.
  4. Add the protocol/port you want to open and the protocol/port it will be applied to on the server.

For example add this:

Load Balancer Protocol: HTTP
Load Balancer Port:     80
Instance Protocol:      HTTP
Instance Port:          8080

If you want to redirect incoming port 80 requests to port 8080 on your instance.

If you do this there will need to be a rule on the EC2 instance's security group to allow incoming connections to 8080 from elastic load balancers like this:

Port range: 8080
Source:     amazon-elb/amazon-elb-sg

Upvotes: 7

Related Questions