Connecting 2 Lightsail on Same regions via Private IP.

0

I have 1 instance of lightsail in LAMP stack and other in NODE stack.

I am trying to load DATA from LAMP Stack to Node frontend,Works fine with public IP yet I am having connecting via Private IP..

Am I Missing something here,

3 Answers
0

When connecting two Lightsail instances in the same region via private IP, there are a few things to consider:

  1. By default, Lightsail instances in the same region can communicate with each other using their private IP addresses without any additional configuration.

  2. Check that you don't have any additional OS-level firewall on the instance directly (apart from Lightsail's firewall configuration) that is blocking connectivity (for example if it restricts source for the incoming connection)

  3. Verify that you're using the correct private IP addresses. You can find the private IP addresses in the Lightsail console for each instance.

  4. Ensure that your application code is correctly configured to use the private IP address of the LAMP stack instance when making database connections from the Node.js instance.

  5. If you've recently changed any networking settings, you might need to restart your instances for the changes to take effect.

  6. Double-check that both instances are indeed in the same region. Lightsail instances can only communicate via private IP if they're in the same region.

If the problem persists after checking these points, you may need to contact AWS support for further assistance.

Sources
Connecting a Lightsail Instance to a VPC on a Different Account, but Same Organization and Same Region | AWS re:Post
Instances - Amazon Lightsail

profile picture
answered 10 days ago
profile pictureAWS
EXPERT
reviewed 9 days ago
profile pictureAWS
EXPERT
revised 9 days ago
  • updated some erroneous information in the AI-generated response

0

The ports you're using must be allowed in the instance's internal firewall, even for private connections.

profile picture
answered 9 days ago
0

Hi,

Can you share what exact error or issue you are experiencing when trying to connect via the Private IPs? With more information we will be better able to help you or make suggestions.

Also to confirm the basic connection working between the instances via their Private IP you can try running ping command from instance A using the private IP of instance B and see that the communication succeeds. Likewise from instance B to instance A

Example: If Instance_A private IP = 172.1.2.3 and Instance_B private IP = 172.4.5.6 then, on Instance_A run below command

 ping 172.4.5.6

and you should see output as

PING 172.4.5.6 (172.4.5.6) 56(84) bytes of data.
64 bytes from 172.4.5.6: icmp_seq=1 ttl=127 time=0.020 ms
64 bytes from 172.4.5.6: icmp_seq=2 ttl=127 time=0.031 ms
64 bytes from 172.4.5.6: icmp_seq=3 ttl=127 time=0.034 ms
64 bytes from 172.4.5.6: icmp_seq=4 ttl=127 time=0.031 ms
...
172.4.5.6 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3093ms

Run similar command on Instance_B.

If the above succeeds then the issue is not connectivity but something else like perhaps some configuration in your application, etc.

Thanks.

profile pictureAWS
EXPERT
answered 9 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions