Justin Anderson
07/06/2026, 8:27 PMMarvin
07/06/2026, 8:27 PMMarvin
07/06/2026, 8:29 PMMarvin
07/06/2026, 8:29 PMJustin Anderson
07/07/2026, 3:33 PMMarvin
07/07/2026, 4:02 PMMarvin
07/07/2026, 4:02 PMservice account srv-acct may only use its API key from host X
What you can do is enforce this at the network boundary for the whole workspace/account:
- IP allowlisting (Enterprise) — only requests from approved IPs/CIDRs can reach the Prefect API/UI
- PrivateLink (Enterprise) — keep access on private AWS networking
So if:
- your trusted host X has a fixed egress IP, and
- that IP is on the allowlist, and
- a developer’s laptop is not on the allowlist,
then a stolen key used from the laptop would fail.
But that protection is not per service account — it applies to access to Prefect Cloud more broadly.
Docs:
- IP allowlisting
- PrivateLink
- Service accounts
Important limitation
If someone steals the key and can run from the allowed host/network (or from another machine behind the same NAT/egress IP), Prefect itself will not distinguish that usage by hostname.
So for your exact security goal, the realistic pattern is:
1. Put deployments behind a dedicated CI/runner host or network
2. Store the API key only there in a secret manager
3. Restrict Prefect Cloud access with IP allowlisting
4. Use a dedicated service account with minimum required workspace role
5. Rotate keys regularly
6. Watch audit logs for unexpected usage
Docs:
- API keys
- Audit logs
If you are not on Enterprise, then Prefect Cloud does not have a native “host/IP restriction” control for this. In that case, your best protection is operational:
- don’t distribute the key
- keep it only in CI/infra secret storage
- use separate service accounts per environment/workspace
- keep permissions minimal
If you want, I can sketch the best available architecture for:
- non-Enterprise Prefect Cloud, or
- Enterprise with IP allowlisting