Finally, I found the answer for my problem. For the error of "connection timeout", one of the reasons can be from the privacy settings. Although I set it as public when creating the RDS instance, the instance is attached with a VPC security group which is not public.
We can attach the RDS instance with a public VPC (I don't think it is a good setting, just for the beginner in AWS like me) as below:
- from Services, select EC2, select Security Groups in the left panel.
- click "Create Security Group" button.
- in the dialog, enter the name for the Group, e.g "postgres-public-access"
- in the dialog, click "Add Rule" button.
- In the "Type" column, select "PostgreSQL" or other types of RDS instances.
- In the "Source" column, enter "0.0.0.0/0".
- Click "Save" button.
- from Services, select RDS, select the RDS instance, click "Modify" button.
- In "Network & Security", "Security group", select the VPC Security Group you just created, in my case, it is "postgres-public-access".
- Click "Continue" button.
Now you can go ahead and connect with your database everywhere.