- Newest
- Most votes
- Most comments
When connecting two Lightsail instances in the same region via private IP, there are a few things to consider:
-
By default, Lightsail instances in the same region can communicate with each other using their private IP addresses without any additional configuration.
-
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)
-
Verify that you're using the correct private IP addresses. You can find the private IP addresses in the Lightsail console for each instance.
-
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.
-
If you've recently changed any networking settings, you might need to restart your instances for the changes to take effect.
-
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
The ports you're using must be allowed in the instance's internal firewall, even for private connections.
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.
Relevant content
- asked 6 years ago
- asked 3 years ago
- asked a year ago
- asked 5 months ago
updated some erroneous information in the AI-generated response