Route53 - Create records using fog

As you can tell from my posts I use fog a lot and it works well in most situations. Here's another one, I want to load up a hosted zone and create a record for my EC2 machine:

require 'fog'
connection ={ :provider => "aws", :aws_access_key_id => access_key, :aws_secret_access_key => secret_key})

zone = connection.zones.get("Z111111QQQQQQQ")

#Create a record:
record = zone.records.create({ :name => "mynewhost.local", :value => [""], :type => "A", :ttl => 300 })

while record.reload.status != "INSYNC"
  sleep 2

#Find that record:
record = zone.records.get("mynewhost.local")
puts record.reload

You'll need to get the hosted zoneID from Amazon (i.e. Z111111QQQQQQQ)