Skip to content

Instantly share code, notes, and snippets.

@thomaswitt
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomaswitt/9645518 to your computer and use it in GitHub Desktop.
Save thomaswitt/9645518 to your computer and use it in GitHub Desktop.
Mass Create Route 53 Domains at AWS
require 'aws-sdk'
AWS.config({
access_key_id: ENV['AWSAccessKeyId'].strip,
secret_access_key: ENV['AWSSecretKey'].strip,
region: 'eu-west-1',
use_ssl: true,
})
r53 = AWS::Route53.new
%w(domain.com domain2.com).each do |domain|
resp = r53.client.create_hosted_zone({
name: domain,
caller_reference: "#{domain}-#{DateTime.now.to_time.to_i}",
hosted_zone_config: { comment: 'My Comment' },
})
resp[:delegation_set][:name_servers].each do |ns|
puts "#{domain}: #{ns}"
end
puts "----------------"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment