Open TomWeishaar opened 6 years ago
After reading AWS docs the rest of the day, I think maybe I have this wrong. The only relevant region may be the one the that the AWS service resides in and the user's region isn't used for anything.
Picking up on the region of the user's instance, like the code does, typically works because it's also where the service is. This doesn't work well for Amazon's email service, but it probably works well for other Amazon services. I'll know more when I actually get this to work.
I'm about to issue a pull request that fixes this issue by allowing the user to enter key, secret, region, and force_credentials = TRUE in the sendemail()
function. The region in this case is the region of the AWS SES server, which, as I mentioned earlier, is unlikely to be the region of the instance. I also added a bit to Details about how to get the needed key and secret from AWS.
I'm not currently able to maintain this package. Would you be interested in taking over?
In the http.R file and its
sesPost()
function, there need to be two different region variables, one for the AWS region of the user's instance, which is incorporated into the credentials, and one for the region of the user's Amazon SES server, which is incorporated into the URL that the request gets sent to, If both are in us-east-1 the code as currently written works fine. In my case, my instance is in us-east-2 and my SES server is in us-east-1, so the code fails.When region is set to us-east-1, my error is:
In sesPOST(body = query, ...) : Forbidden (HTTP 403).
which I'm guessing means a bad signature.When region is set to us-east-2, my error is
Could not resolve host: email.us-east-2.amazonaws.com
Amazon only has SES servers in three regions: us-east-1, us-west-2, and eu-west-1, while it has at least 15 user regions, so the code is likely to fail for many. You can select which of the three regions you want to use in the SES Console (look in the upper-right corner).
I have never successfully formed an AWS signature on my own, so I really appreciate this package. But, for example, in creating the Sig at line 44 (of http.R), I think the
region
variable at line 46 needs to be the region of the user's instance, and theregion
variable in line 51 needs to be the region of the user's SES server.Tom