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?

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ