
Show HN: Simple Dynamic DNS Using the Cloudflare API - lyoshenka
https://github.com/lyoshenka/cloudflare-ddns
======
nmjohn
Nice - I've previously implemented this in (albeit far less extensible) a curl
request, it's been working without hiccup for a while now as a cronjob

    
    
        CURRENT_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
        curl -X PUT 'https://api.cloudflare.com/client/v4/zones/'"$ZONE"'/dns_records/'"$DNS_RECORD_ID" \
          -H "Content-Type:application/json" \
          -H "X-Auth-Key:$AUTH_KEY" \
          -H "X-Auth-Email:$AUTH_EMAIL" \
          --data '{"zone_name":"'$ZONE_NAME'","zone_id":"'$ZONE'","type":"A","name":"'$ZONE_REC_NAME'","content":"'$CURRENT_IP'","data":{},"proxied":false,"proxiable":false,"ttl":1,"priority":1,"id":"'$DNS_RECORD_ID'","locked":false,"modified_on":"2015-08-26T03:10:40.975863Z","created_on":"2015-08-26T03:10:40.975863Z","meta":{"auto_added":false}}'

~~~
lyoshenka
Cool. I also did this using curl at first, before switching to php for more
flexibility. It's not as neatly concise as yours, but I think its pretty
similar:
[https://gist.github.com/lyoshenka/6257440](https://gist.github.com/lyoshenka/6257440)

------
stevekemp
Sounds like a fun project.

I setup some code over at [http://dhcp.io/](http://dhcp.io/) which presents an
API for updating DynamicDNS via Amazon's route53 infrastructure.

I disabled new registrations due to abuse, but the code is open and I have
about 1000 registered users. (5% of whom said they'd pay. 0% of whom did so
when I made it an option. Gave up on charging at that point. Also disabled the
registrations about a day later!)

------
e28eta
I'm also using Cloudflare for DDNS, but I'm using my router's support for
updating DDNS: I'm hosting a basic Sinatra app on Heroku that the router can
ping. The app does a (very basic) auth check, extracts the public IP, and
updates Cloudflare.

