Tom, are you using cloudfront? Your screenshot shows you haven’t put anything in the cloudfront settings.
EDIT: But, if it’s not uploading the files, then it won’t change the URL, no matter if you are using cloudfront or not.
EDIT #2: Also, did you look in your error log on your server? I can access mine form my cpanel. That might give you some info.
Tom, see this for info on a different plugin that seems to work. I installed it on my test site, and it worked.
Hi TraciBunkers
Re: CloudFront.. Yeah, not using it at the moment (might look at that later) – but you’re right, I’m pretty sure it shouldn’t matter, because the problem happens before I get to that point.
Re: the error log… Ah, good idea! I don’t know why I didn’t do that before. The error is illuminating… And I wonder if this is happening because I’m using an EU bucket, rather than the default US one? The error I get is:
Error uploading /srv/www/mywebsite/releases/20140306132721/wp-content/uploads/2014/03/Fullscreen_07_03_2014_16_29.png to S3: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint: “wordpress-media-mywebsite.com.s3.amazonaws.com”., referer: http://mywebsite.com/wordpress/wp-admin/media-new.php
I guess to delve into this further, I should try and look at the code and see what endpoint it’s trying to use… Or see whether it’ll work with a US bucket…
Tom
Ah – yes, I’ve found the bug, I think.
In the plugin, the S3 endpoint is hardcoded to:
s3.amazonaws.com/BUCKETNAME
… which is “path-style syntax”. The s3.amazonaws.com only works for US buckets. For other regions, it has to be changed – for example, for an EU bucket, it should be:
http://s3-euwest-1.amazonaws.com/BUCKETNAME
So I think that’s why it’s not working for my EU bucket.
Another alternative (which works with all regions) is to change the syntax to use endpoints like this:
wordpress-media-mywebsite.com.s3.amazonaws.com
… Which should work for all regions.
I think that, in order to work with all regions, the code needs to be updated to work with domain-type URLs like the one above.
Tom
Tom, look some some of the previous threads if you haven’t already. I think I remember seeing some where people whose buckets weren’t in the US were having problems. And I think the plugin author gave some workarounds–but I’ve looked at so much info, I don’t really remember.
Okay – I’ve got a workaround for making this work with regions outside the US.
This can be fixed short-term by changing line 152 in wp-amazon-web-services-master/classes/amazon-web-services.php
FROM:
$args = array(
‘key’ => $this->get_access_key_id(),
‘secret’ => $this->get_secret_access_key()
);
TO:
$args = array(
‘key’ => $this->get_access_key_id(),
‘secret’ => $this->get_secret_access_key(),
‘region’ => ‘eu-west-1’
);
… Obviously this would need to be added to the admin interface instead of being hardcode here – but adding the region in does fix the problem, and images can now be uploaded to S3.
I guess an enhancement is to either add a “region” dropdown to the admin interface, or – better still – detect the region from the chosen bucket automatically.
Tom
Thanks heaps for this workaround Tom, it has worked perfectly for me. For anyone needing a bucket in the Sydney region change ‘region’ => ‘eu-west-1’ to ‘region’ => ‘ap-southeast-2’
Mandy
Hi Mandy,
Ah – that’s really good news!
Tom
My problem was solved by editing my user policy to this –
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:ListBucketMultipartUploads"
],
"Resource": "arn:aws:s3:::celingest-cdn",
"Condition": {}
},
{
"Action": [
"s3:AbortMultipartUpload",
"s3:DeleteObject*",
"s3:GetObject*",
"s3:PutObject*"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::celingest-cdn/*"
]
},
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*",
"Condition": {}
}
]
}
http://pastebin.com/raw.php?i=ydiQLXGY
http://blog.celingest.com/en/2013/07/19/tutorial-creating-cdn-wordpress-cloudfront-s3/
@tomkerswill
Thank you. That saved some time working it out myself.
And, yes, I agree that an admin dropdown would be ideal.