Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adesoji1/s3-file-downloader
Download files from s3 using golang
https://github.com/adesoji1/s3-file-downloader
Last synced: 17 days ago
JSON representation
Download files from s3 using golang
- Host: GitHub
- URL: https://github.com/adesoji1/s3-file-downloader
- Owner: Adesoji1
- Created: 2023-08-09T11:40:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-28T17:22:24.000Z (about 1 year ago)
- Last Synced: 2023-08-28T23:28:03.436Z (about 1 year ago)
- Language: Go
- Size: 206 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
🚀
# AWS S3 File Downloader written in golang 📦![go](/goerl/golang.png)
This Go project provides a simple and efficient way to download files from an Amazon S3 bucket. It leverages the AWS SDK for Go to interact with S3 and download specified files.
![Go](https://img.shields.io/badge/Go-1.20-blue.svg)
![AWS S3](https://img.shields.io/badge/AWS-S3-orange.svg)## Prerequisites 📋
- Go 1.20 or higher , download [here](https://go.dev/doc/install)
- AWS account with access to S3 ,check this [repo](https://github.com/aws/aws-sdk-go/tree/main)
- AWS credentials configured (either through environment variables or shared credentials file)
- AWS credentials set up either in ~/.aws/credentials or as environment variables.## Installation 🛠️
1. Clone the repository:
```bash
git clone https://github.com/Adesoji1/s3-file-downloader.git```
2. Navigate to the project directory:
```bash
cd s3-file-downloader
```3. Navigate to the working directory:
```bash
cd s3-file-downloader/goerl
```4. Install the required dependencies:
```bash
go mod init goerl
``````bash
go mod tidy
```## Usage 🚀
1. Modify the `bucketName` and `files` variables in `goerl/download_files_in_known_bucket.go` to match your S3 bucket and the files you want to download.
2. TO Connect to any s3bucket to download, use `https://github.com/Adesoji1/s3-file-downloader/tree/main/goerl/download_data.go`
3. Run the program and 🔱 the repo:```bash
go run download_data.go
```## Code Explanation 🧠
- **AWS Session**: The code creates an AWS session using shared credentials or environment variables.
- **S3 Client and Downloader**: An S3 client is created, followed by a downloader that leverages the client to download files.
- **File Download Loop**: The code iterates through a list of specified files, creating a local file for each, and then downloading the corresponding file from S3.
- **Error Handling**: Proper error handling is implemented to gracefully handle any issues that may arise during the download process.
## Contributing 🤝
Feel free to fork the project, make changes, and submit a pull request. Contributions are welcome!
## License 📄
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
## Acknowledgments 🙏
- AWS SDK for Go
- All the contributors who make open-source such a beautiful place!---
Made with ❤️ by [Adesoji Alu](https://github.com/Adesoji1)