ambassador pattern
also: proxy pattern, sidecar proxy
A microservices design pattern where a separate container or process acts as a local proxy, handling communication logic for an application service to external systems.
The ambassador pattern is a structural design pattern commonly used in containerized and microservices architectures. An ambassador is a lightweight proxy that runs alongside your main application container and manages outbound (and sometimes inbound) network communication on its behalf.
The ambassador abstracts away communication complexity from the main application. For example, instead of your Python web service directly connecting to a remote logging service, it sends logs to localhost on a specific port where the ambassador container listens. The ambassador then handles retries, load balancing, authentication, protocol translation, or other networking concerns.
A practical example: your application connects to localhost:8888 for database access. An ambassador proxy running in an adjacent container translates that connection to the actual remote PostgreSQL database at postgres.internal:5432, handling TLS encryption and connection pooling transparently.
This pattern improves separation of concerns, allows you to change network behavior without modifying application code, and enables consistent infrastructure policies across multiple services.