Skip to content
Advertisement

Aws PHP Sdk 3: S3::putObject(): AWS HTTP error: cURL error 6: Couldn’t resolve host ‘s3.Ireland.amazonaws.com’

I’m trying to upload an image to an S3 bucket using the version 3 of the SDK, but I receive the following error:

Error executing “PutObject” on “https://s3.Ireland.amazonaws.com/my-bucket-name/testFile.jpg“; AWS HTTP error: cURL error 6: Couldn’t resolve host ‘s3.Ireland.amazonaws.com’ (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

This is the first time I try to do this, so I’m not much confident.

Uploading a file through the AWS interface, its URL is something like https://s3-eu-west-1.amazonaws.com/my-bucket-name/testFileThroughWeb.jpg. So, it seems to be different from the one created by the AWS SDK to PUT the file (that is https://s3.Ireland.amazonaws.com/my-bucket-name/testFile.jpg)

Another thing I’d like to point out is the version I pass to the constructor of S3Client. Its instance is created passing to it the value stable for the key version while in the bucket policy I use version: "2012-10-17".

This is the configuration of the bucket policy:

JavaScript

To save the image in the bucket, I use this code:

JavaScript

Which could be the cause of the error I’m getting? Why the host https://s3.Ireland.amazonaws.com guessed by the S3Client isn’t correct?

Advertisement

Answer

There is no such AWS region as “Ireland”. The valid regions for S3 are listed on Amazon’s web site; the one you’re probably trying to use here is EU (Ireland), which would be represented in a region parameter as eu-west-1.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement