diff --git a/Dockerfile b/Dockerfile index e29a09c..ed9a9b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,11 @@ RUN apk add --no-cache \ bind-tools \ ; +RUN apk add python curl +RUN curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" +RUN unzip awscli-bundle.zip +RUN ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws + ENV RSYSLOG=y COPY render_cfg.sh / diff --git a/render_cfg.sh b/render_cfg.sh index 25378da..a8ed4d1 100755 --- a/render_cfg.sh +++ b/render_cfg.sh @@ -27,8 +27,8 @@ else # Resolve DNS for _service in ${service//,/ }; do - dig $_service 2>/dev/null | grep ^$_service | awk '{print $5}' - done | sort | paste -sd ',' > $tmpfile + aws servicediscovery list-instances --service-id $_service --query 'Instances[].Attributes.AWS_INSTANCE_IPV4' --output text --region eu-west-1 + done | tr '\t' '\n' | sort | paste -sd ',' > $tmpfile if [ $(wc -c $tmpfile | gawk '{print $1}') -eq 0 ]; then rm $tmpfile echo "Unable to resolve addresses for $service "