Skip to content

Instantly share code, notes, and snippets.

@drofmij
Created September 19, 2022 13:25
Show Gist options
  • Select an option

  • Save drofmij/edf1fb7c7363afdd465e30663a2b4324 to your computer and use it in GitHub Desktop.

Select an option

Save drofmij/edf1fb7c7363afdd465e30663a2b4324 to your computer and use it in GitHub Desktop.
download a file from s3 to /tmp, cat the contents, and delete the temp file
#!/bin/bash
BUCKET=$1
KEY=$2
EARL=${BUCKET}/${KEY}
NAME=$(md5 -q -s ${EARL})
aws s3 cp --quiet s3://${EARL} /tmp/${NAME}
cat /tmp/${NAME}
rm /tmp/${NAME}
@drofmij
Copy link
Author

drofmij commented Sep 19, 2022

Assumes you have aws cli client installed with appropriate credentials for the bucket and assumes you have write permission to the /tmp dir.
I use it for checking contents of config files stored in bucket and text files containing version numbers for deployed artifacts.

Example:
cats3 mybucket myfile

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