Lightsail instance can't access to RDS

0

A Lightsail instance trying to connect to an RDS Postgres database using "psql --hostname=[RDS endpoint URL]" Receiving the error message: """ Is the server running on host "XXXX.rds.amazonaws.com" (XXX) and accepting TCP/IP connections on port 5432? """

The database is accessible from local desktop, but not from the lightsail instance. Public IP of the lightsail instance is open on the RDS relevant security group similar to the local desktop security group.

VPC peering is also enabled on Lightsail, and a security group with the instance's private IP also added

Are there special configuration the LightSail instance/ console needs to open? Any other configurations on RDS ?

Thanks

1 Answer
0

Based on the information provided, it seems like you have already taken the necessary steps to enable access between the Lightsail instance and the RDS instance. However, there might be some additional configuration required to ensure proper connectivity. Please follow these steps:

Check the RDS instance's inbound rules:

In the AWS Management Console, navigate to the RDS dashboard. Click on your RDS instance, and in the "Connectivity & security" tab, click on the security group under "VPC security groups." In the "Inbound rules" tab, make sure that there's a rule allowing access from your Lightsail instance's public IP (if connecting over the public internet) or private IP (if connecting over VPC peering). Verify the RDS instance is publicly accessible:

In the RDS dashboard, click on your RDS instance, and in the "Connectivity & security" tab, check if "Publicly accessible" is set to "Yes." If not, modify the RDS instance to make it publicly accessible, or ensure that you're using VPC peering to access it from the Lightsail instance. Check the Lightsail instance's firewall settings:

In the Lightsail console, click on your instance. Go to the "Networking" tab and check the firewall settings. Make sure that there's a rule allowing outbound traffic on port 5432. Verify the PostgreSQL service is running and accepting connections:

Connect to your RDS instance through the AWS Management Console. Run the following command to check the PostgreSQL configuration file: SHOW config_file; Open the configuration file and ensure the following settings are configured correctly:

listen_addresses = '*'
port = 5432

If you have made any changes, restart the PostgreSQL service. Test connectivity using telnet:

From your Lightsail instance, run the following command to check if there's basic network connectivity to your RDS instance: telnet [RDS endpoint URL] 5432 If the connection is successful, it should display a message similar to "Connected to [RDS endpoint URL]."

profile picture
EXPERT
answered a year ago
  • Thanks for the response.

    • RDS is publicly accessible, Lightsail's IP in an inbound rule and VPC peering is turned on on Lightsail
    • How to run these commands on the RDS Instance? Is there access to that instance from RDS console?
    • On Lightsail Firewall I opened 5432 completely. Is there option to open only outbound?

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