AWS S3 Upload Issue: Wurzelseppi is experiencing an issue with uploading images to S3 from Discourse, despite having the correct EC2 instance profile and bucket settings. The error message indicates that the request cannot be signed without credentials, even though the instance profile should be providing them.
MihirR suggests checking the EC2 instance’s permissions and S3 bucket settings, but Wurzelseppi confirms that the instance has the necessary permissions and that uploading files from the EC2 instance using the AWS CLI works.
Wurzelseppi attempts to use an IAM user with S3 permissions, which allows uploads to work, but Discourse is unable to display the uploaded images due to company-wide restrictions on public access.
Evan_Mallory1 experiences a similar issue and resolves it by using an access key instead of an EC2 instance profile, suggesting a possible bug in instance profile authentication. MihirR provides a potential workaround, but Wurzelseppi decides to abandon S3 uploads due to company restrictions.
Make sure your EC2 instance has the right permissions to upload to S3, like s3:PutObject and s3:GetObject. Double-check your S3 bucket’s region and access settings. You might also want to try turning on s3_use_acls: true if necessary. You can also test uploading directly with AWS CLI to rule out permission issues. And if you’re not using direct uploads, just leave enable_direct_s3_uploads: f as is. Should help fix the problem!
I was getting the same error message as the original poster here, with a similar configuration. I verified that I could get and put s3 objects using the AWS CLI from my EC2 instance even though Discourse was unable to do that.
I created a new IAM user with the same permissions policy as my EC2 instance role and used an access key instead of EC2 instance profile and now uploads work fine.
So in my case it wasn’t an issue of changing permissions, which makes me think that there may be a bug in instance profile authentication. Is there any way for me to get more information about why this was failing?