Created
September 19, 2022 13:25
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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