Fatal error: Out of memory in WordPress running on AWS EC2

Solution:

  1. Try adding this line to your wp-config.php file:

define('WP_MEMORY_LIMIT', '1024M');

  1. If you have access to your PHP.ini file, change the line in PHP.ini

memory_limit = 1024M;

  1. Using htacess.

php_value memory_limit 1024M

PS: Try restarting the PHP service as well