I have hosted a MySQL DB on AWS EC2 instance(t2.micro, ubuntu, free tier). I am able to connect to it and store data. But most of the time, I am unable to connect to it via workbench or my app. But my configurations are correct since I am able to connect to it sometime and store values. The workbench throws the following error: Lost connection to MySQL server at 'reading initial communication packet', system error: 104.
The app throws an ETIMEDOUT error.
What's wrong here? I have checked Cloudwatch metrics also, but there is no warning on CPU out of credits also. This issue persists continuously for days now(between I am able to connect to the DB randomly). and no useful info about it anywhere.
I am trying to connect via my local machine. And the app is hosted in Vercel.