Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new Ohio region (us-east-2) #313

Closed
mark-greene opened this issue Oct 18, 2016 · 12 comments
Closed

Support new Ohio region (us-east-2) #313

mark-greene opened this issue Oct 18, 2016 · 12 comments

Comments

@mark-greene
Copy link

I get the following when I try to access the Ohio region:

.../.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fog-aws-0.12.0/lib/fog/aws.rb:234:in validate_region!': Unknown region: "us-east-2" (ArgumentError)

@geemus
Copy link
Member

geemus commented Oct 18, 2016

Yeah, we have that in place to try and make it more nice and explicit if an invalid region gets passed in (unfortunately it means we need to add new regions as they appear). I think it just needs to be in this list if you'd like to help us update: https://github.com/fog/fog-aws/blob/master/lib/fog/aws.rb#L228 (you could also monkey-patch this method if you need it immediately). Thanks!

@mark-greene
Copy link
Author

mark-greene commented Oct 18, 2016

Monkey-patching gets past the first issue easily but the real problem is change_resource_record_sets.rb. I can't find the magic IDs for elb_hosted_zone_mapping and elb_dualstack_hosted_zone_mapping. Hovering in the console no longer works (at least for me).

@geemus
Copy link
Member

geemus commented Oct 18, 2016

Ah, yeah that is problematic. Looks like it might be available via list hosted zones? http://docs.aws.amazon.com/Route53/latest/APIReference/API_ListHostedZones.html

@chanakyacool
Copy link
Contributor

@mark-greene and @geemus

@mark-greene
Copy link
Author

mark-greene commented Oct 18, 2016

I'll check it out. I found the IDs (http://docs.aws.amazon.com/general/latest/gr/rande.html#elb_region) for ELBs. DNS works well for Instances and ELBs in any region other than Ohio. I haven't been able to successfully monkey-patch elb_dualstack_hosted_zone_mapping (not something I do very often). Still getting error:

.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/excon-0.54.0/lib/excon/middlewares/expects.rb:7:in `response_call': InvalidChangeBatch => "" is not a valid hosted zone id. is not a valid encrypted identifier (Fog::DNS::AWS::Error)

I can make it work by overriding the default behavior but I have to add region specific code in my scripts. Normally I do not have to hardcode "HostedZoneId".

entry.alias_target = { "DNSName": balancer.dns_name, "HostedZoneId": "Z3AADJGX6KTTL2" } entry.save

@geemus
Copy link
Member

geemus commented Oct 18, 2016

@mark-greene got it. If you share the monkey-patch attempt code I might be able to figure out what is going awry.

@mark-greene
Copy link
Author

Just tried the simple patch of elb_dualstack_hosted_zone_mapping

module Fog::DNS
  class AWS
    # See https://forums.aws.amazon.com/message.jspa?messageID=612414
    def self.elb_dualstack_hosted_zone_mapping
      @elb_dualstack_hosted_zone_mapping ||= {
        "ap-northeast-1" => "Z14GRHDCWA56QT",
        "ap-southeast-1" => "Z1LMS91P8CMLE5",
        "ap-southeast-2" => "Z1GM3OXH4ZPM65",
        "eu-central-1"   => "Z215JYRZR1TBD5",
        "eu-west-1"      => "Z32O12XQLNTSW2",
        "sa-east-1"      => "Z2P70J7HTTTPLU",
        "us-east-1"      => "Z35SXDOTRQ7X7K",
        "us-east-2"      => "Z3AADJGX6KTTL2",
        "us-west-1"      => "Z368ELLRRE2KJ0",
        "us-west-2"      => "Z1H1FL5HABSF5",
      }
    end
  end
end

And I use it:

dns = Fog::DNS[:aws]
    zone = dns.zones.detect{|x| x.domain == zone }
    entry = zone.records.new name: record, type: 'A'
    entry.alias_target = {
      "DNSName": balancer.dns_name
    }
    entry.save

Doesn't work in Ohio unless I add "HostedZoneId": "Z3AADJGX6KTTL2"

@geemus
Copy link
Member

geemus commented Oct 21, 2016

Are you sure the entry you are working on is dualstack? Otherwise there is a second set of ids in that file here:

def self.elb_hosted_zone_mapping
(which you might have to patch as well/instead).

@mark-greene
Copy link
Author

Yes, It's dualstack and I've tried both. I haven't spent any more time trying to figure out the patch and am just living with the alias_target workaround. When I get the chance (If it's not been addressed) I try to figure out the patch.

@geemus
Copy link
Member

geemus commented Oct 25, 2016

Sounds good, thanks for the update.

@chanakyad-cuelogic
Copy link
Contributor

I think this PR has the required changes , if we can close this
#332

@geemus and @mark-greene

@geemus
Copy link
Member

geemus commented Dec 16, 2016

@chanakyad-cuelogic good catch, I believe you are correct.

@geemus geemus closed this as completed Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants