S3 (Garage)
This guide shows you how to work with AWS S3 using Garage as a local emulator. This lab demonstrates a data pipeline using Boto3, PyArrow, and Delta Lake (delta-rs).
Prerequisites
Section titled “Prerequisites”- Docker installed and running.
- Dev Containers extension installed (optional).
How to execute
Section titled “How to execute”-
Setup Environment:
Open VS Code in the project folder and execute this command in the Command Palette:
Terminal window > Dev Containers: Reopen in Container- Start Infrastructure: Launch the required containers.
Terminal window docker compose up -d - Run the setup script to install tools and dependencies.
Terminal window scripts/setup.sh
- Start Infrastructure: Launch the required containers.
-
Run the Example:
Terminal window python main.py
How to debug
Section titled “How to debug”-
main.py:
- Open: Open
main.py. - Breakpoints: Set breakpoints in the code.
- Run: Press
F5to start debugging.
- Open: Open
-
Tests:
- Open: Open a test file (e.g.,
tests/components/test_s3_boto.py). - Breakpoints: Set breakpoints in the test code.
- Run: Use the VS Code Testing tab and click the Debug Test icon next to the test you want to debug.
- Open: Open a test file (e.g.,
How to test
Section titled “How to test”- Individually: Run tests individually from the VS Code Testing tab.
- All tests: Run the automated script:
Terminal window scripts/run_tests.sh
Validate results
Section titled “Validate results”- Check Buckets: Verify that
bronzeandsilverbuckets were created.Terminal window aws s3 ls --profile garageTerminal window mise exec -- aws s3 ls --profile garage - Check Content: Verify the files in the silver bucket.
Terminal window aws s3 ls s3://silver --recursive --profile garageTerminal window mise exec -- aws s3 ls s3://silver --recursive --profile garage
- Launch the Rclone graphical interface:
Terminal window scripts/rclone-gui.sh - Open in your browser:
Terminal window http://127.0.0.1:5572 - Log in: If it asks for a username and password, type anything — any value is accepted.
Clean Up
Section titled “Clean Up”docker compose down -vTroubleshooting
Section titled “Troubleshooting”| Issue | Solution |
|---|---|
| Garage API not ready | Ensure the garage container is running and wait a few seconds for the API to initialize. Check logs with docker logs garage. |
| Port 3900 in use | Stop any other service using port 3900 or change the mapping in docker-compose.yml. |