I Tried Using Envoy Behind an ELB to Reverse Proxy over HTTPS to an ALB in a Different VPC via Transit Gateway

I Tried Using Envoy Behind an ELB to Reverse Proxy over HTTPS to an ALB in a Different VPC via Transit Gateway

ELB for Envoy forwarded HTTPS with hostname verification to an ALB in another VPC, both over a normal Transit Gateway and through 1:1 NAT linking VPCs with overlapping CIDRs. With 1:1 NAT, the ALB DNS name timed out; a private hosted zone record with the translated address worked.
2026.11.29

This page has been translated by machine translation. View original

Introduction

On November 25, 2026, Elastic Load Balancing for Envoy (ELB for Envoy) became generally available.

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

In this post, I connected different VPCs with AWS Transit Gateway (TGW) and tested whether the HTTPS endpoint of an internal ALB in another VPC can be used through ELB for Envoy.

I also assumed the case where the CIDRs of the two VPCs overlap, and confirmed connectivity through the 1:1 NAT for AWS Transit Gateway and AWS Cloud WAN announced in October 2026.

https://aws.amazon.com/about-aws/whats-new/2026/10/aws-transit-gateway-cloud-wan-1-1-nat/

Test Environment

  • Region: Tokyo (ap-northeast-1)
  • VPC
    • Envoy-side VPC (where Envoy and EC2 are placed): 10.10.0.0/16
    • ALB-side VPC (where the ALB is placed): 10.20.0.0/16
    • For the 1:1 NAT test, both VPCs use 10.30.0.0/16
    • Subnets: two in each VPC, 1a and 1c (example: 10.10.0.0/26 and 10.10.0.64/26. The other VPCs follow the same pattern)
    • No IGW or NAT gateway is placed; three VPC endpoints for SSM are used
  • TGW
    • Default route table (both association and propagation enabled)
  • ALB (ALB-side VPC)
    • internal, HTTPS 443, fixed response
    • TLS policy: ELBSecurityPolicy-TLS13-1-2-2021-06
    • Certificate: *.example.com in ACM
  • ELB for Envoy (Envoy-side VPC)
    • Envoy: 1.40 (proxyVersion)
    • internal, 2 AZs
  • EC2 (Envoy-side VPC)
    • t4g.nano (Amazon Linux 2023)
    • Operation: Systems Manager Run Command

Architecture

The EC2 instance connects to Envoy over HTTP, and Envoy connects to the ALB over HTTPS.

EC2 → ELB for Envoy(Envoy 側 VPC)→ TGW → ALB(ALB 側 VPC)

First I verify connectivity with a regular TGW, and then I introduce what changes when switching to 1:1 NAT.

Regular Transit Gateway

Network and ALB

The steps for creating the IAM role aws-elb-proxy-role and the proxy are described in the following article. This article proceeds on the assumption that the role has already been created.

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

I created a TGW, created attachments in the subnets (1a and 1c) of both VPCs, and added a route to the other side's CIDR in the route tables of both VPCs. After creating the TGW and the attachments, I waited for their state to become available before running the subsequent commands.

aws ec2 create-transit-gateway \
  --description "elbproxy-tgw phase1" \
  --options DefaultRouteTableAssociation=enable,DefaultRouteTablePropagation=enable \
  --tag-specifications 'ResourceType=transit-gateway,Tags=[{Key=Name,Value=elbproxy-tgw-phase1},{Key=Project,Value=elb-envoy-tgw-nat}]' \
  --query TransitGateway.TransitGatewayId --output text

aws ec2 create-transit-gateway-vpc-attachment \
  --transit-gateway-id <tgw-id> --vpc-id <envoy-vpc-id> \
  --subnet-ids <envoy-subnet-1a-id> <envoy-subnet-1c-id> \
  --tag-specifications 'ResourceType=transit-gateway-attachment,Tags=[{Key=Name,Value=<attachment-name>},{Key=Project,Value=elb-envoy-tgw-nat}]' \
  --query TransitGatewayVpcAttachment.TransitGatewayAttachmentId --output text

aws ec2 create-route --route-table-id <envoy-vpc-route-table-id> \
  --destination-cidr-block 10.20.0.0/16 --transit-gateway-id <tgw-id>
aws ec2 create-route --route-table-id <alb-vpc-route-table-id> \
  --destination-cidr-block 10.10.0.0/16 --transit-gateway-id <tgw-id>

I created the ALB-side attachment in the same way, replacing the VPC and subnets with those of the ALB side.

Next, I checked the default route table of the TGW.

aws ec2 search-transit-gateway-routes --transit-gateway-route-table-id <tgw-route-table-id> \
  --filters Name=state,Values=active \
  --query 'Routes[].[DestinationCidrBlock,Type,TransitGatewayAttachments[0].TransitGatewayAttachmentId]' --output text
10.10.0.0/16	propagated	<envoy-attachment-id>
10.20.0.0/16	propagated	<alb-attachment-id>

The ALB security group (SG) allows TCP 443 from the CIDR of the Envoy-side VPC. The proxy SG allows TCP 80 from the CIDR of the Envoy-side VPC where the EC2 instance resides.

aws ec2 authorize-security-group-ingress --group-id <alb-sg-id> --protocol tcp --port 443 --cidr 10.10.0.0/16 --output json
aws ec2 authorize-security-group-ingress --group-id <proxy-sg-id> --protocol tcp --port 80 --cidr 10.10.0.0/16 --output json

The ALB is internal and was created in the two subnets of the ALB-side VPC. The listener is HTTPS 443 and returns a fixed response (service-b).

ALB listener creation command
aws elbv2 create-listener --load-balancer-arn <alb-arn> \
  --protocol HTTPS --port 443 \
  --certificates CertificateArn=<acm-certificate-arn> \
  --ssl-policy ELBSecurityPolicy-TLS13-1-2-2021-06 \
  --default-actions 'Type=fixed-response,FixedResponseConfig={StatusCode=200,ContentType=text/plain,MessageBody=service-b}' \
  --output json

Name Resolution and Envoy Configuration

To connect with a name that matches the ALB certificate (*.example.com), I created a private hosted zone (PHZ) associated with the Envoy-side VPC and created an alias record to the ALB. To avoid overriding name resolution for the entire domain, I set the zone name to b-alb.example.com, the same as the hostname.

aws route53 create-hosted-zone --name b-alb.example.com \
  --caller-reference <unique-string> \
  --vpc VPCRegion=ap-northeast-1,VPCId=<envoy-vpc-id> \
  --hosted-zone-config Comment=elbproxy-tgw,PrivateZone=true \
  --query HostedZone.Id --output text

aws route53 change-resource-record-sets --hosted-zone-id <hosted-zone-id> \
  --change-batch file://phz-change-phase1.json --output json

phz-change-phase1.json has the following content.

{
  "Changes": [
    {
      "Action": "UPSERT",
      "ResourceRecordSet": {
        "Name": "b-alb.example.com",
        "Type": "A",
        "AliasTarget": {
          "HostedZoneId": "<alb-hosted-zone-id>",
          "DNSName": "<alb-dns-name>",
          "EvaluateTargetHealth": false
        }
      }
    }
  ]
}

I saved the Envoy configuration as config-phase1.yaml. The cluster is STRICT_DNS and points to port 443 of b-alb.example.com. In ELB for Envoy, verifying the certificate hostname (SAN) must be combined with a trusted CA (trusted_ca). Therefore, in validation_context, I specified Amazon Root CA 1 as trusted_ca and wrote a setting that matches the SAN against b-alb.example.com (match_typed_subject_alt_names).

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: "/"
                route:
                  cluster: service_b
                  auto_host_rewrite: true
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  clusters:
  - name: service_b
    type: STRICT_DNS
    dns_lookup_family: V4_ONLY
    connect_timeout: 5s
    load_assignment:
      cluster_name: service_b
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: b-alb.example.com
                port_value: 443
    transport_socket:
      name: envoy.transport_sockets.tls
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
        sni: b-alb.example.com
        common_tls_context:
          validation_context:
            trusted_ca:
              inline_string: |
                <Amazon Root CA 1 の PEM>
            match_typed_subject_alt_names:
            - san_type: DNS
              matcher:
                exact: b-alb.example.com

I created the proxy by passing create-proxy-input.json and config-phase1.yaml.

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-phase1.yaml\} \
  --output json
create-proxy-input.json
{
  "name": "tgw-proxy-phase1",
  "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": "<envoy-subnet-1a-id>" }, { "subnetId": "<envoy-subnet-1c-id>" } ],
      "securityGroups": [ { "securityGroupId": "<proxy-sg-id>" } ]
    }
  }
}

Connectivity Results

On the EC2 instance in the Envoy-side VPC, I ran the following script and sent an HTTP GET to the DNS name of Envoy.

echo "--- getent hosts b-alb.example.com"
getent hosts b-alb.example.com
echo "--- curl proxy"
curl -sS -i --max-time 15 http://<proxy-dns-name>/
--- getent hosts b-alb.example.com
10.20.0.42      b-alb.example.com
10.20.0.82      b-alb.example.com
--- curl proxy
HTTP/1.1 200 OK
server: envoy
date: Sat, 28 Nov 2026 13:36:00 GMT
content-type: text/plain; charset=utf-8
content-length: 9
x-envoy-upstream-service-time: 37

service-b

When I looked up the same name with public DNS (8.8.8.8), NXDOMAIN was returned.

dig b-alb.example.com @8.8.8.8 | grep -E 'status:'
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 22661

Using a name that cannot be resolved by public DNS, Envoy was able to connect to the ALB in the ALB-side VPC.

When Specifying the ALB's DNS Name

Without using the PHZ, I updated the configuration by changing address, sni, and the SAN to match to the DNS name of the ALB (<alb-dns-name>), and performed the same operation. The ALB certificate remains *.example.com.

               socket_address:
-                address: b-alb.example.com
+                address: <alb-dns-name>
                 port_value: 443
 ...
-        sni: b-alb.example.com
+        sni: <alb-dns-name>
 ...
             match_typed_subject_alt_names:
             - san_type: DNS
               matcher:
-                exact: b-alb.example.com
+                exact: <alb-dns-name>
--- getent hosts <alb-dns-name>
10.20.0.42      <alb-dns-name>
10.20.0.82      <alb-dns-name>
--- curl proxy
HTTP/1.1 503 Service Unavailable
content-length: 98
content-type: text/plain
date: Sat, 28 Nov 2026 13:38:04 GMT
server: envoy

upstream connect error or disconnect/reset before headers. reset reason: remote connection failure

The cause of the 503 is the SAN matching. When I updated the configuration by deleting just the four lines of match_typed_subject_alt_names and keeping trusted_ca, the same operation returned 200 (service-b).

Switching to 1:1 NAT

I tore down the regular TGW environment, set the CIDRs of both the Envoy-side VPC and the ALB-side VPC to 10.30.0.0/16, and rebuilt the setup with a new TGW. To this setup, I added NAT rules, routes and SGs that use the translated CIDRs, and name resolution that returns the translated addresses.

The NAT rule configuration and route verification are also covered in the following article. In this article, I focus on the configuration values and the changes.

https://dev.classmethod.jp/articles/transit-gateway-1to1-nat-overlapping-cidr/

NAT Rules and Routes

I created the attachments for both VPCs using the same steps as the regular TGW, and configured NAT rules on both attachments. The Envoy-side attachment translates 10.30.0.0/16 to 100.64.0.0/16, and the ALB-side attachment translates 10.30.0.0/16 to 100.65.0.0/16. If only one side is translated for two VPCs with the same CIDR, the side without a rule treats the reply destination as an address inside its own VPC, and the VPC route table delivers that traffic within the VPC without sending it out to the TGW.

https://docs.aws.amazon.com/vpc/latest/tgw/tgw-nat-how-it-works.html

NAT rule configuration commands and verification results
aws ec2 modify-transit-gateway-attachment-nat-configuration \
  --transit-gateway-attachment-id <envoy-attachment-id> \
  --nat-gateway-support enable \
  --nat-gateway-rules '[{"RuleNumber":100,"MatchSourceCidr":"10.30.0.0/16","NatCidr":"100.64.0.0/16"}]' \
  --output json

The command for the ALB side is the same except for the attachment ID and NatCidr (100.65.0.0/16). I confirmed that NatGatewaySupport became enabled before proceeding to the next step.

When I retrieved the NAT configuration of the attachment after the setup, it looked as follows (Envoy-side example).

aws ec2 get-transit-gateway-attachment-nat-configuration \
  --transit-gateway-attachment-id <envoy-attachment-id> --output json
{
    "TransitGatewayAttachmentId": "<envoy-attachment-id>",
    "NatGatewaySupport": "enabled",
    "NatSystemRouteSupport": "enable",
    "NatGatewayRules": [
        {
            "RuleNumber": 100,
            "MatchSourceCidr": "10.30.0.0/16",
            "NatCidr": "100.64.0.0/16",
            "State": "activated"
        }
    ]
}

I also checked the TGW route table.

100.64.0.0/16	system	active	<envoy-attachment-id>
100.65.0.0/16	system	active	<alb-attachment-id>

The destinations of the VPC routes are the other side's translated CIDRs. In the route table of the Envoy-side VPC, I created a route to the ALB side's translated CIDR, and in the route table of the ALB-side VPC, a route to the Envoy side's translated CIDR, both pointing to the TGW. 10.30.0.0/16 remains local in both VPCs.

VPC route commands
aws ec2 create-route --route-table-id <envoy-vpc-route-table-id> \
  --destination-cidr-block 100.65.0.0/16 --transit-gateway-id <tgw-id>
aws ec2 create-route --route-table-id <alb-vpc-route-table-id> \
  --destination-cidr-block 100.64.0.0/16 --transit-gateway-id <tgw-id>

The ALB SG allows TCP 443 from the translated CIDR of the Envoy-side VPC. The proxy SG allows TCP 80 from the Envoy-side VPC's CIDR 10.30.0.0/16.

ALB SG command
aws ec2 authorize-security-group-ingress --group-id <alb-sg-id> --protocol tcp --port 443 --cidr 100.64.0.0/16 --output json

Name Resolution and Envoy Configuration

1:1 NAT translates only IP addresses and does not rewrite DNS responses. Hostnames resolve to the pre-translation addresses, so I prepared DNS records that return the translated addresses.

https://aws.amazon.com/blogs/networking-and-content-delivery/introducing-11-nat-on-aws-transit-gateway-and-aws-cloud-wan/

I obtained the actual addresses of the ALB nodes, replaced them with the translated addresses, and registered them as A records in the PHZ. As with the regular TGW, the PHZ was associated with the Envoy-side VPC, and the zone name was set to d-alb.example.com, the same as the hostname.

aws ec2 describe-network-interfaces \
  --filters "Name=description,Values=ELB app/<alb-name>/<alb-id>" \
  --query 'NetworkInterfaces[].PrivateIpAddress' --output text

The host part stays the same, and the network part is replaced with the ALB side's translated CIDR 100.65.0.0/16. The ALB nodes this time are 10.30.0.51 and 10.30.0.76, which become 100.65.0.51 and 100.65.0.76 after translation.

aws route53 change-resource-record-sets --hosted-zone-id <hosted-zone-id> \
  --change-batch file://phz-change-phase2.json --output json

phz-change-phase2.json has the following content. The values are fixed values created from the addresses of the ALB nodes at the time of creation.

{
  "Changes": [
    {
      "Action": "UPSERT",
      "ResourceRecordSet": {
        "Name": "d-alb.example.com",
        "Type": "A",
        "TTL": 60,
        "ResourceRecords": [{"Value":"100.65.0.51"},{"Value":"100.65.0.76"}]
      }
    }
  ]
}

The Envoy configuration (config-phase2.yaml) differs from config-phase1.yaml only in the following six lines.

-                  cluster: service_b
+                  cluster: service_d
 ...
-  - name: service_b
+  - name: service_d
 ...
-      cluster_name: service_b
+      cluster_name: service_d
 ...
-                address: b-alb.example.com
+                address: d-alb.example.com
 ...
-        sni: b-alb.example.com
+        sni: d-alb.example.com
 ...
-                exact: b-alb.example.com
+                exact: d-alb.example.com

Connectivity Results

On the EC2 instance in the Envoy-side VPC, I ran a script of the same form and sent an HTTP GET to the DNS name of Envoy.

--- getent hosts d-alb.example.com
100.65.0.76     d-alb.example.com
100.65.0.51     d-alb.example.com
--- curl proxy
HTTP/1.1 200 OK
server: envoy
date: Sat, 28 Nov 2026 13:53:01 GMT
content-type: text/plain; charset=utf-8
content-length: 9
x-envoy-upstream-service-time: 50

service-d

The ALB SG allows only 443 from 100.64.0.0/16. Since 200 was returned with this setting, it shows that the connection from Envoy reached the ALB with the translated address.

When Specifying the ALB's DNS Name

I rebuilt the same configuration with NAT rules set on both attachments. Since this check looks only at the path, I used a configuration that does not include SAN matching (validation_context has only system_root_certs), changed address and sni to the ALB's DNS name (<alb-dns-name>), and performed the same operation. I did not create a PHZ.

--- getent hosts <alb-dns-name>
10.30.0.52      <alb-dns-name>
10.30.0.121     <alb-dns-name>
--- curl proxy
HTTP/1.1 503 Service Unavailable
content-length: 91
content-type: text/plain
date: Sat, 28 Nov 2026 10:33:25 GMT
server: envoy

upstream connect error or disconnect/reset before headers. reset reason: connection timeout

The ALB's DNS name resolved to 10.30.0.x, which is the same CIDR as the Envoy-side VPC itself. Since 10.30.0.0/16 is local in the Envoy-side VPC's routes, I infer that this traffic went toward the inside of the Envoy-side VPC without going out to the TGW, and therefore did not reach the ALB.

Differences Between Regular TGW and 1:1 NAT

Item Regular TGW 1:1 NAT
Additional TGW configuration None NAT rules on both attachments
Destination of VPC routes The other side's actual CIDR The other side's translated CIDR
Source allowed by the ALB SG Actual CIDR of the Envoy-side VPC Translated CIDR of the Envoy-side VPC
Hostname The ALB's DNS name gives 503 (remote connection failure) due to SAN matching. The PHZ name gives 200 The ALB's DNS name gives 503 (connection timeout; configuration without SAN matching). Registering A records with translated addresses in the PHZ gives 200

Summary

The addresses of ALB nodes change. The A records in the PHZ this time are fixed values created from the addresses of the ALB nodes at the time of creation. Therefore, with 1:1 NAT, a configuration that places an NLB with fixed IPs in front of the ALB is desirable.

ELB for Envoy → Transit Gateway (1:1 NAT) → NLB → ALB

With a regular Transit Gateway, if you omit SAN matching, you can write the ALB's DNS name directly without a PHZ. However, since the connection succeeds even with a name that does not match the certificate, this should be limited to cases where you can accept this risk.

I hope this serves as a reference when building a mechanism that places ELB for Envoy in an aggregation VPC and relays traffic through Transit Gateway to an ALB in another VPC.

Share this article

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