Open BAGELreflex opened 5 years ago
Hi @BAGELreflex - I did get back to the official AWS SDK in V7, which is now available for testing and should allow for either inputting key/secret or using default provider or instance profiles: https://github.com/WP2Static/wp2static/releases/tag/7.0-alpha-003
duplication/solvable in same issue as https://github.com/WP2Static/static-html-output-plugin/issues/12
Already solved in V7 (https://github.com/WP2Static/wp2static) and will likely find that same deployment code brought back into this V6 (Static HTML Output)
Just pinging on this - looks like this issue is still ongoing.
Client-side form validation in settings for Access Key ID and Secret Key ID demands a value even if an instance profile/role is being used.
A test upload with no values returns an ambiguous 'BAD RESPONSE STATUS FROM API (400)'.
I can confirm however that the manual provision of an IAM user (not desired as above) does work.
Would be super grateful if this could be looked at 🤞
https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.Credentials.CredentialProvider.html
Currently the plugin requires the usage of an IAM Access Key and Secret Access Key to be provided in order to authenticate to S3 to upload. This is not industry best practice. The default
CredentialProvider
attempts to load credentials in the following order:AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
andAWS_SESSION_TOKEN
~/.aws/credentials
~/.aws/config
'credentials' => ['key' => 'my-access-key-id', 'secret' => 'my-secret-access-key']
configuration of the client constructor given that no other credentials are found.We configure the majority of our sensitive site configuration using either Environment Variables or IAM Roles assigned to EC2 instances, utilizing the EC2 instance metadata (option 6 above).
Here is an implementation that would use the key and secret, if provided, and otherwise revert to the default order of operations: