Last active
December 20, 2015 08:34
-
-
Save cjjavellana/5de7c660e9e9681d792c to your computer and use it in GitHub Desktop.
Create Route 53 Subdomain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_r53subdomain | |
begin | |
r53client = Aws::Route53::Client.new | |
resp = r53client.change_resource_record_sets({ | |
hosted_zone_id: "<hosted zone id>", | |
change_batch: { | |
comment: "Create subdomain", | |
changes: [ | |
{ | |
action: "CREATE", | |
resource_record_set: { | |
name: "#{subdomain}.cjavellana.me", | |
type: "CNAME", | |
ttl: 60, | |
resource_records: [ | |
{ | |
value: "cjavellana.me." | |
}, | |
], | |
} | |
} | |
] | |
} | |
}) | |
rescue => e | |
raise e | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment