Monday, December 31, 2012

How to Create DNS Records using Linode API


dns = Fog::DNS.new(provider: 'linode',
                                    linode_api_key: 'your-linode-api-key-goes-here')
zone = dns.zones.create(domain: 'your-domain.com',
                 email: 'admin@your-domain.com')
zone.nameservers

Create a www version of your site and point to the right IP.
record = zone.records.create(value:  '1.2.3.4', name: 'your-domain.com', type: 'A')

To make www.your-domain.com go to the same place, use a cname record:
record = zone.records.create(value: 'your-domain.com', name: 'www', type: 'CNAME')