I've setup the low cost AWS lightsail server for multiple wordpress sites following the article- https://www.wpmentor.com/wordpress-with-nginx-lightsail/
Server runs good for normal requests. But after a while, I needed to install W3 Total Cache and clear all the cache after moving sites from localhost/github. But when I'm clearing all cache, the site goes on loading and after a while it returns 504 Gateway Timeout. Also the lightsail instance goes down and can't even connect with ssh, it's need to stopped and started again (reboot don't works either). Lightsail matrix shows the CPU burst over 80/100 %.
I'm very confused about the whole situation. Please somebody help me!
The $3.50 plan gives you a t2.micro, which only has 512MB of memory and 1 burstable CPU.
I'd be surprised if there's enough RAM on that system to be able to support a cache. It's probably paging heavily to disk, which would directly impact performance.
You'll probably need to move to a larger instance type.
See: Creating a larger instance, block storage disk, or database from a snapshot in Amazon Lightsail | Lightsail Documentation