I have created an AWS Lambda function in the default VPC which is running every 5 minutes. The Lambda function is making JDBC connection to fetch data from RDS.
I am getting following error:
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
The RDS instance in a us-east region, The Lambda and EC2 are in a us-west region
I am able to access RDS in my EC2 ubuntu machine but not able to access RDS in the Lambda function. My security group is allowing access from anywhere to MySQL port 3306.