https://github.com/antoonline/sync-local-files-to-aws-s3-via-bash
This is a simple bash script to upload css and image files to a public AWS S3 bucket.
https://github.com/antoonline/sync-local-files-to-aws-s3-via-bash
Last synced: 3 months ago
JSON representation
This is a simple bash script to upload css and image files to a public AWS S3 bucket.
- Host: GitHub
- URL: https://github.com/antoonline/sync-local-files-to-aws-s3-via-bash
- Owner: AntoOnline
- License: mit
- Created: 2021-03-31T23:56:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-01T03:31:18.000Z (about 2 years ago)
- Last Synced: 2025-01-14T08:14:07.777Z (5 months ago)
- Language: Shell
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Bash script to upload files to an AWS S3 bucket #
This is a simple bash script to upload css and image files to a public AWS S3 bucket.
Example:
```
./s3uploader.sh /home/s3uploads s3://public-bucket
```The script only uploads if:
- the number of files in the folder has changed. The current filecount is written to a .filecounts file
- the file does not exist in the S3 bucketNOTE: The script then set the image ACL to PUBLIC READ!!!!
Supported files: css, jpg, jpeg, gif, bmp, svg - and does not check sub folders
The credentials are read via the default AWS credential config
1. Download .sh script.
2. Make the script executable:
```
chmod +x s3uploader.sh
```3. Make sure the AWS CLI is installed
4. Make sure you have the public AWS S3 bucket configured
5. Make sure you have AWS IAM credentials with access to the Bucket
6. Add the credentials to the AWS CLI using ./aws configure
7. Run the script:
```
s3uploader.sh /local-images-cache s3://public-images-cache
```## Want to connect?
Feel free to contact me on [Twitter](https://twitter.com/OnlineAnto), [DEV Community](https://dev.to/antoonline/) or [LinkedIn](https://www.linkedin.com/in/anto-online) if you have any questions or suggestions.
Or just visit my [website](https://anto.online) to see what I do.