I Tried Exposing ELB for Envoy to Another VPC via PrivateLink Through an NLB

I Tried Exposing ELB for Envoy to Another VPC via PrivateLink Through an NLB

Registering the proxy's IP as an NLB IP target and exposing that NLB as an endpoint service returned a fixed response over PrivateLink to requests from an EC2 instance in another VPC. The NLB doesn't automatically follow proxy IP changes, so a mechanism was needed.
2026.11.28

This page has been translated by machine translation. View original

Introduction

On November 25, 2026, the general availability of ELB for Envoy was announced.

https://aws.amazon.com/about-aws/whats-new/2026/11/elastic-load-balancing-for-envoy-generally-available/

ELB for Envoy is a new Elastic Load Balancing (ELB) load balancer type that runs open-source Envoy as a proxy. In this article, I will build a configuration that places an NLB in front of ELB for Envoy and uses it from another VPC via PrivateLink. I will also check how the NLB targets are handled when the proxy's IP changes.

Test environment

  • Region: Tokyo (ap-northeast-1)
  • VPCs: two in the same account
  • Internet connectivity: none (no internet gateway or NAT gateway was created in either VPC)
  • VPC-A: 10.10.0.0/24 (1a is 10.10.0.0/26, 1c is 10.10.0.64/26)
  • VPC-B: 10.20.0.0/24 (1a is 10.20.0.0/26, 1c is 10.20.0.64/26)
  • Envoy version (proxyVersion): 1.40
  • Client EC2: one in each VPC (t4g.nano, Amazon Linux 2023)
  • Operations: AWS Systems Manager Run Command

Architecture

The load balancers that can be specified for an endpoint service are a Network Load Balancer (NLB) or a Gateway Load Balancer. The arguments of create-vpc-endpoint-service-configuration are --network-load-balancer-arns for an NLB and --gateway-load-balancer-arns for a Gateway Load Balancer.

https://docs.aws.amazon.com/vpc/latest/privatelink/create-endpoint-service.html

The ELB for Envoy documentation (overview, setup, limits), the product page, and the announcement did not mention PrivateLink. So I built a configuration that places an NLB in front of an internal ELB for Envoy and uses that NLB as the endpoint service.

I register the proxy's IPs with the NLB as ip targets. After the proxy became active, running the following command on the EC2 instance in VPC-A returned two proxy IPs.

$ getent ahostsv4 <proxy-dns-name> | awk '{print $1}' | sort -u
<ip-1c-old>
<ip-1a>

The path is as follows.

VPC-B のクライアント
  → インターフェイスエンドポイント
  ── PrivateLink ──
  → VPC-A の NLB(internal、TCP 80、ip ターゲット)
  → ELB for Envoy(internal、固定応答)

VPC-A のクライアント
  → VPC 内から NLB またはプロキシへ接続

Build

The steps for creating the proxy role aws-elb-proxy-role and the proxy are covered in the following article. This article assumes them.

https://dev.classmethod.jp/articles/aws-elb-for-envoy-ga-create-proxy/

The commands I ran for this build are included in the collapsible section of each item.

Security groups

To the proxy security group (SG) in VPC-A, I added a rule allowing TCP 80 from the VPC-A CIDR. I did not attach an SG to the NLB. To the endpoint SG in VPC-B, I added a rule allowing TCP 80 from the client SG.

Commands to add security group rules
aws ec2 authorize-security-group-ingress --group-id <proxy-sg-id> --protocol tcp --port 80 --cidr 10.10.0.0/24

aws ec2 authorize-security-group-ingress --group-id <endpoint-sg-id> --protocol tcp --port 80 --source-group <client-sg-id>

Proxy

I created the proxy as internal and specified the two subnets in VPC-A and the SG above. The Envoy configuration listens on port 80 and returns status 200 with a fixed body via direct_response for requests to all paths.

Proxy configuration file and creation command

Save the Envoy configuration as config-01-fixed-response.yaml.

admin:
  address:
    socket_address:
      address: 127.0.0.1
      port_value: 9901
static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 80
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: ingress_http
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match:
                  prefix: "/"
                direct_response:
                  status: 200
                  body:
                    inline_string: "hello from ELB for Envoy\n"
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

Save the input JSON as create-proxy-input.json.

{
  "name": "privatelink-proxy",
  "type": "envoy",
  "proxyVersion": "1.40",
  "roleArn": "arn:aws:iam::<account-id>:role/aws-elb-proxy-role",
  "networkConfiguration": {
    "ipConfiguration": {
      "ipAddressingConfiguration": { "ipv4Addressability": "internal", "ipv6Addressability": "off" }
    },
    "vpcConfiguration": {
      "subnets": [ { "subnetId": "<subnet-a1-id>" }, { "subnetId": "<subnet-a2-id>" } ],
      "securityGroups": [ { "securityGroupId": "<proxy-sg-id>" } ]
    }
  }
}

The creation command is as follows.

aws elb-proxy create-proxy --cli-input-json file://create-proxy-input.json --cli-binary-format raw-in-base64-out --configuration 'configurationFile={configurationBytes@=file://config-01-fixed-response.yaml}' --output json

It took about 3 minutes 40 seconds from the start of creation until the state became active. The dnsName in the response started with internal-.

NLB

I retrieved the IPs of the ENIs with the proxy SG attached, then created a target group with target type ip, an internal NLB, and a listener, in that order. The NLB's subnets are the same two as the proxy's.

NLB creation commands
aws ec2 describe-network-interfaces --filters Name=group-id,Values=<proxy-sg-id> --query 'NetworkInterfaces[].PrivateIpAddress' --output text

aws elbv2 create-target-group --name elbproxy-pl-tg --protocol TCP --port 80 --target-type ip --vpc-id <vpc-a-id> --health-check-protocol HTTP --health-check-path / --query 'TargetGroups[0].TargetGroupArn' --output text

aws elbv2 register-targets --target-group-arn <tg-arn> --targets Id=<ip-1a>,Port=80 Id=<ip-1c-old>,Port=80

aws elbv2 create-load-balancer --name elbproxy-pl-nlb --type network --scheme internal --subnets <subnet-a1-id> <subnet-a2-id> --query 'LoadBalancers[0].[LoadBalancerArn,DNSName]' --output text

aws elbv2 create-listener --load-balancer-arn <nlb-arn> --protocol TCP --port 80 --default-actions Type=forward,TargetGroupArn=<tg-arn> --query 'Listeners[0].ListenerArn' --output text

About 3 minutes after the NLB was created, both targets became healthy. Below are Target.Id, Target.AvailabilityZone, and TargetHealth.State excerpted from the output of describe-target-health.

{
    "TargetHealthDescriptions": [
        {
            "Target": {
                "Id": "<ip-1a>",
                "AvailabilityZone": "ap-northeast-1a"
            },
            "TargetHealth": {
                "State": "healthy"
            }
        },
        {
            "Target": {
                "Id": "<ip-1c-old>",
                "AvailabilityZone": "ap-northeast-1c"
            },
            "TargetHealth": {
                "State": "healthy"
            }
        }
    ]
}

Endpoint service

I made the NLB an endpoint service, limited the principals allowed to connect to the same account, and created an interface endpoint in VPC-B.

Commands to create the endpoint service and endpoint
aws ec2 create-vpc-endpoint-service-configuration --network-load-balancer-arns <nlb-arn> --no-acceptance-required --query 'ServiceConfiguration.[ServiceId,ServiceName]' --output text

aws ec2 modify-vpc-endpoint-service-permissions --service-id <service-id> --add-allowed-principals arn:aws:iam::<account-id>:root --output json

aws ec2 create-vpc-endpoint --vpc-endpoint-type Interface --vpc-id <vpc-b-id> --service-name <service-name> --subnet-ids <subnet-b1-id> <subnet-b2-id> --security-group-ids <endpoint-sg-id> --query VpcEndpoint.VpcEndpointId --output text

The endpoint became available about 30 seconds after creation.

Verification

Via the NLB (VPC-A)

From the EC2 instance in VPC-A, I ran curl against the proxy's DNS name and the NLB's DNS name.

$ curl -sS -m 10 -w 'HTTP %{http_code}\n' http://<proxy-dns-name>/
hello from ELB for Envoy
HTTP 200
$ curl -sS -m 10 -w 'HTTP %{http_code}\n' http://<nlb-dns-name>/
hello from ELB for Envoy
HTTP 200

About 1 minute 20 seconds after the endpoint became available, I ran curl from the EC2 instance in VPC-B against the endpoint's regional DNS name.

$ curl -sS -m 8 -w 'HTTP %{http_code}\n' http://<endpoint-dns-name>/
hello from ELB for Envoy
HTTP 200

The results were the same with the 1a and 1c DNS names.

Changing the proxy's IP

Replacing a subnet

I replaced the 1c subnet used by the proxy with a new subnet.

aws ec2 create-subnet --vpc-id <vpc-a-id> --cidr-block 10.10.0.128/26 --availability-zone ap-northeast-1c

aws elb-proxy update-proxy-network-configuration --proxy-identifier <proxy-arn> --vpc-configuration 'subnets=[{subnetId=<subnet-a1-id>},{subnetId=<subnet-a3-id>}],securityGroups=[{securityGroupId=<proxy-sg-id>}]'

About 1 minute after the update, an ENI with <ip-1c-new> was added in 1c. The 1a IP did not change.

Besides subnet replacement, the proxy's IP also changes with load.

https://dev.classmethod.jp/articles/elb-for-envoy-per-ip-throughput/

Re-registering targets

With an NLB using ip targets, you need to manually re-register targets when a target's IP changes. I registered <ip-1c-new> as an NLB target, and after it became healthy, I deregistered the old IP.

aws elbv2 register-targets --target-group-arn <tg-arn> --targets Id=<ip-1c-new>,Port=80

aws elbv2 wait target-in-service --target-group-arn <tg-arn> --targets Id=<ip-1c-new>,Port=80

aws elbv2 deregister-targets --target-group-arn <tg-arn> --targets Id=<ip-1c-old>,Port=80

Summary

ELB for Envoy could be used via PrivateLink by registering the proxy's IPs as ip targets of an NLB and making that NLB an endpoint service.

However, because the proxy's IP can change dynamically, you need a mechanism to update the IPs registered as NLB targets.

In environments where the load fluctuates in particular, the proxy's IP is likely to change frequently, so I recommend evaluating the use of PrivateLink via an NLB, including whether you can operate it.

I would like to cover methods other than PrivateLink for using the proxy across VPCs (such as relaying via Transit Gateway or 1:1 NAT) in another article.

Share this article

AWSのお困り事はクラスメソッドへ