Created
December 20, 2022 03:00
-
-
Save jsbonso/30d8e177ce5c438e938aec3e1bf63595 to your computer and use it in GitHub Desktop.
Upload new file to Amazon S3 via AWS CLI
This file contains 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
# Get the latest file that's added in the folder | |
LATEST_FILE=`ls -tp | grep -v /$ | head -1` | |
echo $LATEST_FILE | |
# Upload the new file to your Amazon S3 Bucket. | |
# In this example, the "jonbonso-media" S3 bucket has an associated CloudFront distribution | |
# with a custom domain of "media.jonbonso.com" | |
aws s3 cp $LATEST_FILE s3://jonbonso-media | |
# Only applicable for Mac Users | |
# Copy the CDN URL to your clipboard | |
echo https://media.jonbonso.com/$LATEST_FILE | pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment