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?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠