Ambassador
Put a local helper between an app and the remote services it calls, to handle retries, timeouts, routing and credentials on the app's behalf.
Description
An ambassador is an outbound proxy that runs next to the application, usually as a sidecar. The app sends a simple request to localhost; the ambassador takes care of the hard parts of calling the outside world: service discovery, TLS, authentication, retries with backoff, circuit breaking and metrics.
It's especially useful for legacy applications you can't easily change. Wrap one in an ambassador and it gains modern resilience and security without a code change. It's a specific kind of Sidecar, focused on outbound calls.
System design
Ambassador system design diagram
- Legacy app (service): calls localhost:9000.
- Ambassador (gateway): retries · timeouts · auth.
- Secrets manager (external service).
- Partner API (external service).
- Step 1: Legacy app → Ambassador: plain HTTP.
- Step 2: Ambassador → Secrets manager: fetch API key.
- Step 3: Ambassador → Partner API: HTTPS + key, retries.
- Step 4: Ambassador → Legacy app: response.
- The legacy app makes a plain HTTP call to localhost, as it always did.
- The ambassador fetches the partner API key, so the app never handles the secret.
- It calls the partner API over HTTPS with timeouts, retries with backoff and a circuit breaker.
- It returns the result to the app, which gained resilience and security without a code change.
- AWS
- Envoy sidecar in ECS/EKS; AWS App Mesh; IAM Roles Anywhere or Secrets Manager agent.
- Azure
- Dapr sidecar for service invocation; Envoy on AKS; Key Vault CSI driver.
- Google Cloud
- Envoy on GKE; Cloud Service Mesh egress policies; Secret Manager CSI driver.
When to use it
Use it when
- A legacy or third-party application calls remote services and you can't add resilience code to it.
- Many services call the same external dependency and should handle it the same way.
- Credentials for a remote service should be injected outside the application.
Avoid it when
- You control the code and use one language. A good client library does the same with less moving parts.
- Latency is so critical that an extra local hop isn't acceptable.
Pitfalls
- Hidden retries: the app retries and so does the ambassador, multiplying load. Decide which layer owns retries.
- Debugging becomes harder when failures happen in a process the app team doesn't own. Expose the ambassador's metrics.
- One ambassador configuration shared by many apps with different needs. Keep it per app.
Alternatives
Sidecar
Choose it when the helper does something other than outbound calls, such as logging or inbound TLS.
Circuit Breaker library
Choose it when you can change the code and want resilience in-process.
Proxy
Choose it when you mean the in-process object pattern, not a separate network process.