Connection between EC2 instance and RDS

1

We have the database of 3 websites on a single RDS mySQL instance, and sometimes 1 website gets disconnected from the database and goes down without affecting other websites. We came to the conclusion that the disconnection could be due to one the 2 cases below:-

  1. Something is going wrong in the connection the Database and EC2 instance on which the website is hosted.
  2. There may be a connection pool issue on the application end as we manually set up the connection pool in the code of the website as we use Jave.

To figure out the root cause of the disconnection if any as per point 1), we activated VPC flow logs, but are unable to figure out how to filter the logs such that we can know what goes on when the disconnection happens. The custom log format we have set is below:

${instance-id} ${srcaddr} ${srcport} ${pkt-srcaddr} ${pkt-src-aws-service} ${dstaddr} ${dstport} ${pkt-dstaddr} ${pkt-dst-aws-service} ${flow-direction} ${traffic-path} ${action} ${log-status}

How do we filter the logs based on traffic flowing from the suspected EC2 instance and the RDS so we can figure out what is happening and what is the cause for the disconnection?

  • Have you been able to resolve your issue? If so, would you select an answer that matched your issue to close out the thread?

2 個答案
0
已接受的答案

You can use the following filter pattern in CloudWatch Logs to search (all logs streams) for either of the two IP addresses in the log group, for example:

  • 10.1.1.1 - server 1
  • 10.2.2.2 - server 2

like this:

%10\.1\.1\.1|10\.2\.2\.2%

Simply update this with your server IPs.

See more syntax rules here: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html#matching-terms-events

AWS
LondonX
已回答 8 個月前
0

Hi,

To analyse VPC flow logs, you can use Athena and do simple SQL queries against them. Please follow the documentation https://docs.aws.amazon.com/athena/latest/ug/vpc-flow-logs.html

profile picture
專家
已回答 8 個月前
profile pictureAWS
專家
已審閱 8 個月前
  • Thank you very much for your reply. Our flow logs are sent to cloudwatch logs and according to the document, flow logs must be sent to S3. Is there any way to filter logs which show details of the connection between our RDS and EC2?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南