Skip to content

Instantly share code, notes, and snippets.

@spazm
Created April 6, 2015 20:22
Show Gist options
  • Save spazm/926060205fde73d2b858 to your computer and use it in GitHub Desktop.
Save spazm/926060205fde73d2b858 to your computer and use it in GitHub Desktop.
# wrapper around aws s3 to simpllify get/put of secure resources from our s3 bucket.
AWS:= aws
S3:=s3://secure.example.com
S3PATH:=/
FILE=secure.conf
REMOTE=${S3}${S3PATH}${FILE}
help:
@echo "get: fetch secure.conf from S3"
@echo "put: put secure.conf to S3"
@echo "ls: list secure.conf on remote S3"
@echo "g_keys: get authorized_keys from S3"
@echo "p_keys: push authorized_keys from S3"
@echo "ls_keys: list authorized_keys on S3"
@echo "vars: list vars"
vars:
@echo "S3: ${S3}"
@echo "S3PATH: ${S3PATH}"
@echo "FILE: ${FILE}"
p_keys g_keys ls_keys: S3PATH=/users/airmedia/
p_keys g_keys ls_keys: FILE=authorized_keys
g_keys: get
p_keys: put
ls_keys: ls
fetch: get
get:
${AWS} s3 cp ${REMOTE} ${FILE}
put:
${AWS} s3 cp ${FILE} ${REMOTE}
ls:
${AWS} s3 ls ${REMOTE}
@spazm
Copy link
Author

spazm commented Apr 6, 2015

yes, Make is totally the wrong tool for this job, but fun nonetheless.
target-specific variable is used on lines 24,25 to override vars for certain targets. Neat!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment