What is Egress Proxy Gateway (EPG)?
Egress Proxy Gateway (EPG) is a fully managed outbound traffic proxy service provided by Alibaba Cloud. It exposes a unified HTTP/HTTPS outbound proxy entry point for cloud applications in a virtual private cloud (VPC) and supports egress IP address management, access policy control, and traffic scheduling. EPG is especially suitable for scenarios that involve actively initiated outbound connections, such as AI agents and sandboxes.
Scenarios
-
AI agents accessing large language model APIs
AI agent applications frequently call external large language model (LLM) APIs. EPG's public egress address pool provides multiple Elastic IP Addresses (EIPs). Combined with scheduling policies, it rotates the egress IP addresses, which reduces the risk that calls from a single IP address are rate limited by the destination service. You can also use rules to restrict the domain names and URL paths that an agent can access.
-
Enterprise outbound security and compliance
Customers in the finance and government industries need to control outbound traffic. Configure whitelist rules in EPG (default action Deny, with only specific domain names allowed) to restrict the external resources that applications can access. After TLS interception is enabled, EPG can inspect the content of HTTPS requests. Access logs can be delivered to Simple Log Service (SLS) to facilitate security audits.
-
Egress IP address isolation for multiple tenants
Multi-tenant Software as a Service (SaaS) businesses assign an independent egress IP address to each tenant. Consistent hashing scheduling maps requests from the same source to the same egress IP address. Different business lines can be associated with different egress address pools to isolate outbound traffic at the business level.
-
Cross-region outbound access
Applications can use EPG's private egress address pool to forward traffic to the destination region over Cloud Enterprise Network (CEN) and then access the Internet.
EPG is currently in public preview and does not provide a service level agreement (SLA). To use EPG for production workloads, contact your business manager.
How it works
EPG uses an explicit HTTP/HTTPS proxy to take over outbound requests from applications. Applications in a VPC only need to configure a proxy address, either by using an environment variable or by specifying the address in code. No VPC route changes are required, and applications can then proactively send outbound requests to an EPG instance. After receiving a request, EPG parses the request content, controls and audits outbound access based on factors such as the destination domain name, URL path, and HTTP header, and completes the forwarding or blocking according to the following process:
PreDns,PreRequest, andPostResponseare the three check phases in the EPG request processing flow. They correspond to before domain name resolution, before a request is sent, and after a response is received. You can configure Allow or Deny rules in thePreDnsandPreRequestphases. In thePostResponsephase, the action is currently fixed to Allow.
-
Access: A client connects to the proxy endpoint (a private IP address of an elastic network interface, ENI) of an EPG instance in a VPC by using its DNS domain name. For HTTPS requests, the client uses the HTTP CONNECT method. For HTTP requests, the client sends standard HTTP requests.
-
PreDns (check before domain name resolution): EPG matches the source IP address or destination domain name against the rules in the
PreDnsphase of an egress rule group as the first round of matching. If a Deny rule is matched, EPG returns a rejection response. If an Allow rule is matched, EPG proceeds to DNS resolution. If no rule is matched, EPG performs the default action of this phase (Allow or Deny). -
DNS resolution: EPG sends a query to the internal DNS servers in the VPC (
100.100.2.136and100.100.2.138) to resolve the destination domain name on behalf of the client and obtain the destination IP address. -
PreRequest (check before a request is sent): EPG matches the request against the rules in the
PreRequestphase of the egress rule group based on multiple conditions, such as the source IP address, destination domain name, URL path, HTTP request method, and HTTP header. If a Deny rule is matched, EPG returns a rejection response. If an Allow rule is matched, EPG proceeds to egress IP address selection. If no rule is matched, EPG performs the default action of this phase (Allow or Deny). -
Egress IP address selection: EPG selects an egress IP address from the egress address pool associated with the instance based on the scheduling policy. The scheduling policy supports random scheduling (requests are randomly distributed across multiple IP addresses) and consistent hashing scheduling (requests from the same source always use the same IP address). Egress address pools can be public, which use EIPs to access the Internet, or private, which use private IP addresses in a VPC to access an internal network or forward traffic over CEN.
-
Forwarding: EPG uses the selected egress IP address as the source address to send the request to the destination service and get the response.
-
PostResponse (processing after a response is received): EPG processes the received response. The action is fixed to Allow, and adding rules in this phase is not currently supported.
If TLS interception is not enabled for an EPG instance, a client uses the CONNECT method to establish an end-to-end encrypted tunnel to the destination server through EPG for HTTPS requests. EPG only passes through the traffic without parsing the request content in the tunnel. In this case, HTTPS requests do not enter the PreRequest phase, and the rules and default action of this phase do not take effect for them. These requests are forwarded directly through the default egress address pool. To control HTTPS traffic in the PreRequest phase (for example, in-depth matching based on URL paths or HTTP headers), enable TLS interception. EPG then decrypts HTTPS traffic before matching rules and forwarding requests.
Get started with EPG
-
Quick start: Follow Getting started and complete client access verification.
-
Console operations: Log on to the EPG console to manage instances, egress address pools, egress proxy configurations, and rule groups.