page:guides:flask:object client
Configure S3-compatible access for Flask
Object storage client for a Flask app on Ample. Verified on Flask: bucket credentials delivered as encrypted S3_* environment variables and a validated PutObject/GetObject round-trip linked to a database row (upload=ok linked=ok).
Build and start
- pip install into .ample/python from requirements.txt, then waitress from app.py reading PORT on the python-3.12 template.
Prerequisites
- A Flask project (pip install into .ample/python from requirements.txt, then waitress from app.py reading PORT on the python-3.12 template)
- A bucket from
ample bucket createwith credentials passed as encrypted S3_* environment variables - An Ample account token with servers:write, buckets:read
Resource Requirements
- primitive:compute
- primitive:s3-compatible-object-storage
Workflow Steps
Build and start
pip install into .ample/python from requirements.txt, then waitress from app.py reading PORT on the python-3.12 template; the server must bind 0.0.0.0 on PORT.Create the bucket and pass its credentials
Create it once withample bucket create, then pass endpoint, region, bucket and keys with --env; use path-style addressing.
Command:ample deploy . --name --public --start "python3 app.py" --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=...Verify
Fetch the live URL and /p/browser-file-uploads on the example; on failure read the build and runtime logs.
Command:ample logs --kind build
Success Checks
- app responds on its public URL
Kind: http_get, Path: /, Expect: ample canary flask patterns - browser-file-uploads check from the example
Kind: http_get, Path: /p/browser-file-uploads, Expect: see the pattern fixture checks
Limitations
- Verified on the python-3.12 template at s-1vcpu-1gb; other sizes and Flask major versions are not verified.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- PutObject and GetObject with path-style addressing are verified; other S3 operations are not.
Examples
- Flask pattern fixture: Verified object storage client on Flask. Source Reference:
tests/deploy-canaries/flask-patterns.
Cost Estimate
- Currency: USD
- Monthly Amount: 5.0
- Components:
- App Server: Size: s-1vcpu-1gb, Quantity: 1.0, Monthly Amount: 5.0
- Note: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.
System Setup
- Tested Configuration:
- Template: python-3.12
- Runtime: python
- Size: s-1vcpu-1gb
- Install:
python3 -m pip install --target .ample/python -r requirements.txt - Start:
PYTHONPATH=.ample/python:${PYTHONPATH:-} python3 app.py
Evidence Summary
- Canary run: Flask pattern fixture deployed on Ample (pip install into .ample/python from requirements.txt, then waitress from app.py reading PORT on the python-3.12 template); for this guide: bucket credentials delivered as encrypted S3_* environment variables and a validated PutObject/GetObject round-trip linked to a database row (upload=ok linked=ok). Observed At: 2026-09-21T01:14:18Z
- Implementation Revision: 50dbac567d2c5cc8e55e6c748a646be0025d9cfb-dirty (CLI 0.1.21)
- Expires At: 2027-03-20T01:14:18Z