humanmade/aws-ses-wp-mail

AWS_SES_WP_MAIL_USE_INSTANCE_PROFILE is not actually used

Closed this issue · 3 comments

The ENV variable AWS_SES_WP_MAIL_USE_INSTANCE_PROFILE doesn't seem to actually be used.

In a test environment keys are used, however deployed onto a shared AWS infrastructure, AWS_SES_WP_MAIL_USE_INSTANCE_PROFILE=false will still lookup the metadata server

Not sure if you mean the actual environment (system) variables? Setting the actual environment variable is unsupported, you need to set the constant in PHP instead.

If the issue is just the difference between production and test, this is behaviour inside the AWS SDK itself, which we don't control. If you're not defining the key and secret, these aren't passed into the SDK, which causes it to internally fall back to the instance profile. That is, USE_INSTANCE_PROFILE really just means "ignore the key and secret being not-set".

I have system env variables set and this in the wp-config

/* AWS SES Configuration */
define( 'AWS_SES_WP_MAIL_REGION', env('AWS_SES_WP_MAIL_REGION'));
define( 'AWS_SES_WP_MAIL_KEY', env('AWS_SES_WP_MAIL_KEY'));
define( 'AWS_SES_WP_MAIL_SECRET', env('AWS_SES_WP_MAIL_SECRET'));

It still insists on pulling the instance IAM permissions.

99% certain this is actually caused by v3 of the AWS SDK being loaded before this plugin is, which causes it to switch to v3 behaviour: #22.

#27 will fix this.