Skip to content

Instantly share code, notes, and snippets.

@riaf
Created March 29, 2013 03:23
Show Gist options
  • Save riaf/5268561 to your computer and use it in GitHub Desktop.
Save riaf/5268561 to your computer and use it in GitHub Desktop.
Route53 で管理しているドメインを一覧で見たかったので
AWS = require "aws-sdk"
AWS.config.update
accessKeyId: "chacococco"
secretAccessKey: "chacococco"
region: "us-east-1"
route53 = new AWS.Route53
route53.client.listHostedZones {}, (err, data) ->
if err
throw err
for hostedZone in data.HostedZones
route53.client.listResourceRecordSets { HostedZoneId: hostedZone.Id }, (err, data) ->
if err
throw err
for ResourceRecordSet in data.ResourceRecordSets
for ResourceRecord in ResourceRecordSet.ResourceRecords
console.log "#{ ResourceRecordSet.Type }\t#{ ResourceRecordSet.Name }\t#{ ResourceRecord.Value }"
console.log "\n==============================\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment