WordPress on EC2 Requires FTP Credentials to Install Plugins
The main issue here is that apache does not have access to the folders. The default permission is given to the ec2-user in the AMI.
run this in your terminal and you should be good to go.
sudo chown -R apache:apache /var/www/html
Once this is done you should be able to upload themes, plugins, updates etc.
change owner of wordpress directory
sudo chown -R www-data:www-data /var/www/wordpress
OR try
define('FS_METHOD', 'direct');