page:guides:starlette:configuration secrets
Configure environment and secrets for Starlette
Summary
Configuration and secrets for a Starlette app on Ample. Verified on Starlette: an --env value delivered encrypted and reported as present without being echoed (secret=set). Build and start: pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template.
Resource Requirements
- Compute
Infrastructure Requirements
- Compute
Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
Workload
Configure environment and secrets
Prerequisites
- A Starlette project (pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template)
- An Ample account token with servers:write
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 run.py
Workflow Steps
Build and start
pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template; the server must bind 0.0.0.0 on PORT.Pass values on deploy
Use --env KEY=value (repeatable) or --env-file; values are encrypted at rest and reused on redeploys. Declare names only in ample.toml.
Command:ample deploy . --name --public --start "python3 run.py" --env MY_SECRET=...Verify
Fetch the live URL and /p/configuration-secrets on the example; on failure read the build and runtime logs.
Command:ample logs --kind build
Examples
- Starlette pattern fixture
Verified configuration and secrets on Starlette.
Success Checks
App responds on its public URL
- Kind: http_get
- Path: /
- Expect: ample canary starlette patterns
Configuration-secrets check from the example
- Kind: http_get
- Path: /p/configuration-secrets
- Expect: see the pattern fixture checks
Limitations
- Verified on the python-3.12 template at s-1vcpu-1gb; other sizes and Starlette major versions are not verified.
- Region, compliance attestations, and request-duration limits are unknown and not claimed.
Cost Estimate
- Currency: USD
- Monthly Amount: 5.0
- Basis: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty
- Components:
- App server
- Size: s-1vcpu-1gb
- Quantity: 1.0
- Monthly Amount: 5.0
- App server
- Note: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.
Evidence Summary
- Canary Run: Starlette pattern fixture deployed on Ample (pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template); for this guide: an --env value delivered encrypted and reported as present without being echoed (secret=set).
- Observed At: 2026-09-21T01:21:36Z
- Implementation Revision: 50dbac567d2c5cc8e55e6c748a646be0025d9cfb-dirty (CLI 0.1.21)
- Expires At: 2027-03-20T01:21:36Z
Last Verified At
2026-09-21T01:21:36Z
Unknowns
- Region availability is unknown until a verified region fact is recorded
- Compliance attestations are unknown; none are claimed.