WordPress website(4years old) have been recently migrated from shared server to the AWS server (2cpu, 4GB ram,80 SSD).After migration website was working fine but in the night between 2am and 6am the CPU is showing spike in the usage(only on Saturday or Sunday) which cause the CPU to run out of memory and shutting down the whole server and also mail servers. After restarting the server website is running properly and also there is no spike in the CPU usage(10% - 15%). Screen shot of the logs attached https://prnt.sc/LTyOU9YrEHd6. Error logs before the website is down Usage after the server restart
What may be causing the problems with the CPU usage?, Is it because of the spamd usage or SQL usage?