From 65b079c8d023b6a92cd6fd853da51208d43a550d Mon Sep 17 00:00:00 2001 From: Vince Tse Date: Sat, 23 Apr 2016 14:54:46 +0000 Subject: [PATCH 1/2] Use alpine image --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 30a5753..909af97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -FROM stackbrew/ubuntu:13.10 -MAINTAINER Oliver Soell "oliver@timelinelabs.com" +FROM alpine:3.3 +MAINTAINER Vince Tse -RUN apt-get update -qq -RUN apt-get install -y python-boto python-requests +RUN apk update +RUN apk upgrade +RUN apk add py-boto py-requests ADD bin/route53-presence /bin/route53-presence From a161b9f30227342e7a1da4433a4603977e6bb036 Mon Sep 17 00:00:00 2001 From: Vince Tse Date: Sat, 23 Apr 2016 15:58:16 +0000 Subject: [PATCH 2/2] Update readme --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 446a645..32ff349 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,65 @@ -route53-presence -================ +# vincetse/route53-presence -Docker container which registers the local ec2 instance into route53 +Docker container which registers the local EC2 instance into Route53. + +This is a fork of [timelinelabs/docker-route53-presence](https://github.com/timelinelabs/docker-route53-presence) which doesn't have a Docker Hub repo. I have updated the script so that it can handle hostnames with 3rd-level domains (i.e. host.subdomain.example.com). I have sent a [pull request](https://github.com/timelinelabs/docker-route53-presence/pull/1) to get the change incorporated, but decided to roll on my own given that repo hasn't been updated since March 2014. + +``` +docker run --rm timelinelabs/docker-route53-presence -h +usage: route53-presence [-h] [--ttl TTL] [--local] hostname + +Register or unregister a name in Route53. + +positional arguments: + hostname fqdn to manipulate + +optional arguments: + -h, --help show this help message and exit + --ttl TTL ttl in seconds, default 600 + --local use local IP instead of public +``` + +## Example Usage + +``` +# Passing AWS keys as environment variables +docker run --name route53-presence \ + -e AWS_ACCESS_KEY=XXX \ + -e AWS_SECRET_KEY=XXX \ + vincetse/route53-presence \ + --ttl=300 \ + host.subdomain.example.com + +# Omitting AWS keys if the EC2 instance has a role that allows Route 53 actions. See below. +docker run --name route53-presence \ + vincetse/route53-presence \ + --ttl=300 \ + host.subdomain.example.com +``` + +## AWS IAM Role + +The AWS credentials can be omitted if the host has a valid IAM role that allows for the following permissions: + +``` +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "route53:GetHostedZone", + "route53:ChangeResourceRecordSets" + ], + "Resource": "arn:aws:route53:::hostedzone/" + }, + { + "Effect": "Allow", + "Action": [ + "route53:ListHostedZones" + ], + "Resource": "*" + } + ] +} +```