Route53 API Client (wrongly?) requires a region in its config
Closed this issue · 3 comments
An error is raised if the Route53 Client is used for #list_hosted_zones without a region specified, despite the route53 endpoint for this operation not being region-specific.
The v1 API didn't require a region for this API, which is the correct behaviour I think.
The v1 API did require a region, but supplied a default region of 'us-east-1'. In v2, the region is always required. This is especially important as we use signature version 4 now for all services. Sigv4 requires the region name be known and is part of the signature.
As a work-around, you can provide a global default region via Aws.config
:
# default region for ALL services, behaves like v1
Aws.config[:region] = 'us-east-1'
# or set a default region for Route53 only
Aws.config[:route53] = { region: 'us-east-1' }
You can of course override the Aws.config
defaults:
Aws.config[:region] = 'us-east-1'
s3 = Aws::S3::Client.new
s3.config.region
#=> 'us-east-1'
# override default region
s3 = Aws::S3::Client.new(region: 'us-west-2')
s3.config.region
#=> 'us-west-2'
Cool: I've already changed my code to set the us-east-1 region for the route53 API.
You might want to amend this page though: http://docs.aws.amazon.com/general/latest/gr/rande.html#r53_region
Thanks. I'll pass the feedback along to the documentation maintainers.