Sunday, March 12, 2017

Connecting Amazon RDS from onpremis gives ORA-12170: TNS:Connect timeout occurred

##########################
## Error
##########################

ORA-12170: TNS:Connect timeout occurred

##########################
#  Error Occurred
##########################

I've created a new AWS RDS database and tried to connect the database using sqlplus from my laptop.

##########################
## Command Executed
##########################

sqlplus

**************************************** Step By Step Analysis ******************************************************

#########################################
# 1) Check the network connectivity
#########################################

ORA-12170: TNS:Connect timeout occurred

Above error usually occurs when there is no network connectivity between source and target. As the connections in AWS RDS are controlled via Security Groups, lets check the Security Group Inbound Rules.

Login to console and Choose RDS Under Database and then choose Instances. Select the Database you are trying to connect.




Click the Details Tab.

Click on the Security Groups. This will take you to the security groups page.

Click Inbound Tab,


=====================================================================================================================

#########################################
# 2) Reason for Failure
#########################################

From above output we can see only 154.59.142.48/32 is allowed to login via 1521 port number.

So to connect from my laptop, i need to add my ip address or allow this instance to be accessible to everyone based upon your requirement.

=====================================================================================================================

##########################
## Solution
##########################

#########################################
# 3) Add New Rule
#########################################

In "Inbound" tab, click Edit and a new Rule. Choose "Oracle-RDS" as type and in the source choose "Anywhere" (accessible to public)


Click Save and then the Inbound rules looks as below.


=====================================================================================================================
Establish the connection now and it works good.
=====================================================================================================================

=====================================================================================================================
 Comments Are Always welcome
=====================================================================================================================

No comments: