To use the Amazon Web Services plugin and it’s addon WP Offload S3 you need to define an AWS access key and secret key. This can be stored in the database or defined in your wp-config.php file like this:
define( 'AWS_ACCESS_KEY_ID', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx' ); define( 'AWS_SECRET_ACCESS_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx' );
However, if you host your WordPress site on an EC2 instance you won’t necessarily want to distribute your access credentials onto the instance, and will want to make use of IAM Roles.
After creating an IAM role you can use the ‘AWS_USE_EC2_IAM_ROLE’ constant to tell the AWS plugin not to ask for or require the access key and access secret:
define( 'AWS_USE_EC2_IAM_ROLE', true );