
I Tried Connecting to Aurora (PostgreSQL / MySQL) Through ELB for Envoy
This page has been translated by machine translation. View original
Introduction
On November 25, 2026, the general availability of Elastic Load Balancing for Envoy (ELB for Envoy) was announced.
The basic features of ELB for Envoy are covered in a previous article.
In the previous article, I tried relaying HTTP (HTTPS).
The ELB for Envoy announcement does not mention relaying DB connections, but I relayed Aurora PostgreSQL and Aurora MySQL with Envoy's TCP listener and tried connecting to the DB through the proxy from EC2. This article presents the results.
Test environment
- Region: Tokyo (ap-northeast-1)
- aws-cli: 2.42.4
- Proxy: ELB for Envoy (Envoy 1.40, internal, 2 private subnets)
- Aurora capacity: Serverless v2, minimum 0.5 ACU, maximum 2 ACU, 1 instance each
- Client: EC2 t4g.small (Amazon Linux 2023, arm64), mysql 8.4.13, psql 17.12
- CA bundle: RDS global bundle (global-bundle.pem, placed in /root/ on the client)
Test setup
Network and SGs
I created a new VPC for testing and placed the internal proxy, the client, and Aurora in private subnets of the same VPC. I set up a NAT gateway as the path for the proxy to send access logs to CloudWatch Logs.
SG permissions are set up in two stages: client to proxy, and proxy to Aurora.
- Proxy SG: allow 3306 and 5432 from the client SG
- Aurora SG: allow 3306 and 5432 from the proxy SG
From Aurora's point of view, the connection source is the proxy's IP.
Aurora
The Aurora settings are as follows.
- Aurora PostgreSQL: 17.9
- Aurora MySQL: 8.4.mysql_aurora.8.4.12
- Authentication: password authentication for both engines
- TLS-required settings: PostgreSQL has rds.force_ssl set to 1 (default), MySQL has require_secure_transport set to ON. Both are values in custom DB cluster parameter groups
- Disabling the TLS requirement: change rds.force_ssl to 0 and require_secure_transport to OFF
Aurora creation commands
Creating the parameter groups (PostgreSQL and MySQL)
aws rds create-db-cluster-parameter-group --db-cluster-parameter-group-name elbdb-verify-pg17 --db-parameter-group-family aurora-postgresql17 --description "elbdb verify pg17"
aws rds create-db-cluster-parameter-group --db-cluster-parameter-group-name elbdb-verify-mysql84 --db-parameter-group-family aurora-mysql8.4 --description "elbdb verify mysql84"
aws rds modify-db-cluster-parameter-group --db-cluster-parameter-group-name elbdb-verify-mysql84 --parameters ParameterName=require_secure_transport,ParameterValue=ON,ApplyMethod=immediate
Aurora PostgreSQL (express configuration)
aws rds create-db-cluster --db-cluster-identifier elbdb-verify-pg --engine aurora-postgresql --with-express-configuration --enable-vpc-networking --no-enable-internet-access-gateway --db-subnet-group-name elbdb-verify --vpc-security-group-ids <DB-SG> --serverless-v2-scaling-configuration MinCapacity=0.5,MaxCapacity=2
aws rds modify-db-cluster --db-cluster-identifier elbdb-verify-pg --master-user-authentication-type password --master-user-password <DB-PASSWORD> --apply-immediately
aws rds modify-db-cluster --db-cluster-identifier elbdb-verify-pg --db-cluster-parameter-group-name elbdb-verify-pg17 --apply-immediately
Aurora MySQL (standard launch)
aws rds create-db-cluster --db-cluster-identifier elbdb-verify-mysql --engine aurora-mysql --engine-version 8.4.mysql_aurora.8.4.12 --master-username dbadmin --master-user-password <DB-PASSWORD> --serverless-v2-scaling-configuration MinCapacity=0.5,MaxCapacity=2 --db-subnet-group-name elbdb-verify --vpc-security-group-ids <DB-SG> --db-cluster-parameter-group-name elbdb-verify-mysql84 --storage-encrypted --no-deletion-protection
aws rds create-db-instance --db-instance-identifier elbdb-verify-mysql-1 --db-cluster-identifier elbdb-verify-mysql --engine aurora-mysql --db-instance-class db.serverless --no-publicly-accessible
Proxy
The Envoy settings are as follows.
- Listeners: two
tcp_proxylisteners- mysql_tcp: relays connections on port 3306 to Aurora MySQL
- postgres_tcp: relays connections on port 5432 to Aurora PostgreSQL
- Upstream: defined as STRICT_DNS clusters, with the Aurora cluster endpoints specified as addresses
- Access log: place open_telemetry in the access_log of tcp_proxy and send to the CloudWatch Logs OTLP endpoint
- Access log destination cluster cwl_otlp: configured with aws_request_signing
Envoy configuration file (envoy.yaml)
admin:
address:
socket_address:
address: 127.0.0.1
port_value: 9901
static_resources:
listeners:
- name: mysql_tcp
address:
socket_address:
address: 0.0.0.0
port_value: 3306
filter_chains:
- filters:
- name: envoy.filters.network.tcp_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: mysql_tcp
cluster: aurora_mysql
access_log:
- name: envoy.access_loggers.open_telemetry
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.open_telemetry.v3.OpenTelemetryAccessLogConfig
http_service:
http_uri:
uri: https://logs.ap-northeast-1.amazonaws.com/v1/logs
cluster: cwl_otlp
timeout: 5s
request_headers_to_add:
- header:
key: x-aws-log-group
value: /elbdb-verify/access
- header:
key: x-aws-log-stream
value: tcp-1
log_name: access
resource_attributes:
values:
- key: service.name
value:
string_value: elb-for-envoy-db-verify
body:
string_value: '[%START_TIME%] mysql %DOWNSTREAM_REMOTE_ADDRESS% -> %UPSTREAM_HOST% rx=%BYTES_RECEIVED% tx=%BYTES_SENT% duration=%DURATION%ms flags=%RESPONSE_FLAGS%'
attributes:
values:
- key: engine
value:
string_value: 'mysql'
- key: start_time
value:
string_value: '%START_TIME%'
- key: downstream_remote_address
value:
string_value: '%DOWNSTREAM_REMOTE_ADDRESS%'
- key: upstream_cluster
value:
string_value: '%UPSTREAM_CLUSTER%'
- key: upstream_host
value:
string_value: '%UPSTREAM_HOST%'
- key: bytes_received
value:
string_value: '%BYTES_RECEIVED%'
- key: bytes_sent
value:
string_value: '%BYTES_SENT%'
- key: duration_ms
value:
string_value: '%DURATION%'
- key: response_flags
value:
string_value: '%RESPONSE_FLAGS%'
- key: connection_termination_details
value:
string_value: '%CONNECTION_TERMINATION_DETAILS%'
- key: requested_server_name
value:
string_value: '%REQUESTED_SERVER_NAME%'
- name: postgres_tcp
address:
socket_address:
address: 0.0.0.0
port_value: 5432
filter_chains:
- filters:
- name: envoy.filters.network.tcp_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: postgres_tcp
cluster: aurora_postgres
access_log:
- name: envoy.access_loggers.open_telemetry
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.open_telemetry.v3.OpenTelemetryAccessLogConfig
http_service:
http_uri:
uri: https://logs.ap-northeast-1.amazonaws.com/v1/logs
cluster: cwl_otlp
timeout: 5s
request_headers_to_add:
- header:
key: x-aws-log-group
value: /elbdb-verify/access
- header:
key: x-aws-log-stream
value: tcp-1
log_name: access
resource_attributes:
values:
- key: service.name
value:
string_value: elb-for-envoy-db-verify
body:
string_value: '[%START_TIME%] postgres %DOWNSTREAM_REMOTE_ADDRESS% -> %UPSTREAM_HOST% rx=%BYTES_RECEIVED% tx=%BYTES_SENT% duration=%DURATION%ms flags=%RESPONSE_FLAGS%'
attributes:
values:
- key: engine
value:
string_value: 'postgres'
- key: start_time
value:
string_value: '%START_TIME%'
- key: downstream_remote_address
value:
string_value: '%DOWNSTREAM_REMOTE_ADDRESS%'
- key: upstream_cluster
value:
string_value: '%UPSTREAM_CLUSTER%'
- key: upstream_host
value:
string_value: '%UPSTREAM_HOST%'
- key: bytes_received
value:
string_value: '%BYTES_RECEIVED%'
- key: bytes_sent
value:
string_value: '%BYTES_SENT%'
- key: duration_ms
value:
string_value: '%DURATION%'
- key: response_flags
value:
string_value: '%RESPONSE_FLAGS%'
- key: connection_termination_details
value:
string_value: '%CONNECTION_TERMINATION_DETAILS%'
- key: requested_server_name
value:
string_value: '%REQUESTED_SERVER_NAME%'
clusters:
- name: aurora_mysql
type: STRICT_DNS
dns_lookup_family: V4_ONLY
connect_timeout: 5s
load_assignment:
cluster_name: aurora_mysql
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: <MYSQL-CLUSTER-ENDPOINT>
port_value: 3306
- name: aurora_postgres
type: STRICT_DNS
dns_lookup_family: V4_ONLY
connect_timeout: 5s
load_assignment:
cluster_name: aurora_postgres
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: <POSTGRESQL-CLUSTER-ENDPOINT>
port_value: 5432
- name: cwl_otlp
type: STRICT_DNS
dns_lookup_family: V4_ONLY
connect_timeout: 5s
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http_protocol_options: {}
http_filters:
- name: envoy.filters.http.aws_request_signing
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.aws_request_signing.v3.AwsRequestSigning
service_name: logs
region: ap-northeast-1
- name: envoy.filters.http.upstream_codec
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.upstream_codec.v3.UpstreamCodec
load_assignment:
cluster_name: cwl_otlp
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: logs.ap-northeast-1.amazonaws.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: logs.ap-northeast-1.amazonaws.com
common_tls_context:
validation_context:
system_root_certs: {}
Create the log group and stream for the access log destination before the proxy. The creation method is covered in a previous article.
Files and commands used to create the proxy
create-proxy-input.json (internal, 2 subnets)
{
"name": "elbdb-verify",
"type": "envoy",
"proxyVersion": "1.40",
"roleArn": "arn:aws:iam::<ACCOUNT-ID>:role/elbdb-verify-proxy-role",
"networkConfiguration": {
"ipConfiguration": {
"ipAddressingConfiguration": { "ipv4Addressability": "internal", "ipv6Addressability": "off" }
},
"vpcConfiguration": {
"subnets": [ { "subnetId": "<SUBNET-A>" }, { "subnetId": "<SUBNET-C>" } ],
"securityGroups": [ { "securityGroupId": "<PROXY-SG>" } ]
}
}
}
trust-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Service": "elasticloadbalancing.amazonaws.com" },
"Action": "sts:AssumeRole"
}
]
}
role-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"],
"Resource": [
"arn:aws:logs:*:*:log-group:/aws/elb-proxy/*",
"arn:aws:logs:*:*:log-group:/aws/elb-proxy/*:log-stream:*"
]
},
{
"Effect": "Allow",
"Action": ["logs:CreateLogStream", "logs:PutLogEvents"],
"Resource": [
"arn:aws:logs:ap-northeast-1:*:log-group:/elbdb-verify/access",
"arn:aws:logs:ap-northeast-1:*:log-group:/elbdb-verify/access:log-stream:*"
]
}
]
}
Creation command (the configuration file is saved as envoy.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://envoy.yaml}'
create-proxy accepted the two tcp_proxy listeners and the open_telemetry placed in access_log without rejecting them. It took about 2 minutes 20 seconds for the status to go from create-in-progress to active.
PostgreSQL connection
I connected from EC2 to the proxy's DNS name and confirmed that the result of the SQL "select version()" was returned.
With TLS required
I connected with sslmode set to verify-ca.
psql "host=<PROXY-DNS-NAME> port=5432 dbname=postgres user=postgres sslmode=verify-ca sslrootcert=/root/global-bundle.pem" -c "select version();" -c "select ssl, version, cipher from pg_stat_ssl where pid = pg_backend_pid();"
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 17.9 on aarch64-unknown-linux-gnu, compiled by aarch64-unknown-linux-gnu-gcc (GCC) 10.5.0, 64-bit
(1 row)
ssl | version | cipher
-----+---------+------------------------
t | TLSv1.3 | TLS_AES_256_GCM_SHA384
(1 row)
pg_stat_ssl shows the state of the connection as seen from the Aurora side. Since ssl is t, TLS is not terminated at the proxy and passes through from the client to Aurora.
Results by sslmode.
| sslmode | Result | pg_stat_ssl |
|---|---|---|
| verify-ca | Connected | ssl=t, TLSv1.3 |
| disable | Rejected by Aurora | - |
The error for disable.
psql: error: connection to server at "<PROXY-DNS-NAME>" (<PROXY-IP>), port 5432 failed: FATAL: no pg_hba.conf entry for host "<PROXY-IP>", user "postgres", database "postgres", no encryption
With the TLS requirement disabled
I set rds.force_ssl in the DB cluster parameter group to 0 to disable the TLS requirement.
aws rds modify-db-cluster-parameter-group --db-cluster-parameter-group-name elbdb-verify-pg17 --parameters ParameterName=rds.force_ssl,ParameterValue=0,ApplyMethod=immediate
With verify-ca, the connection still worked over TLSv1.3. With sslmode set to disable, ssl in pg_stat_ssl was f, and version and cipher were empty. I was able to run SQL without TLS.
ssl | version | cipher
-----+---------+--------
f | |
(1 row)
MySQL connection
Connection with the initial settings
I connected from the MySQL client to the mysql_tcp listener, which has the same configuration as postgres_tcp.
mysql -h <PROXY-DNS-NAME> -P 3306 -u dbadmin -p'<DB-PASSWORD>' --connect-timeout=40 --ssl-mode=VERIFY_CA --ssl-ca=/root/global-bundle.pem -e "select version();"
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
It took 15.013 seconds to fail with the error. Even after setting require_secure_transport to OFF with the following command to disable the TLS requirement, the result did not change.
aws rds modify-db-cluster-parameter-group --db-cluster-parameter-group-name elbdb-verify-mysql84 --parameters ParameterName=require_secure_transport,ParameterValue=OFF,ApplyMethod=immediate
Even after setting it to OFF, it failed with the same error after 15.013 seconds with VERIFY_CA and after 15.021 seconds with --ssl-mode=DISABLED.
The process log for these connections (debug; how to configure it is described in "Process log") showed only a single line: listener filter times out after 15000 ms. No tcp_proxy session was created.
Workaround
Adding two lines to the mysql_tcp listener made the connection work.
- name: mysql_tcp
address:
socket_address:
address: 0.0.0.0
port_value: 3306
listener_filters_timeout: 1s
continue_on_listener_filters_timeout: true
With listener_filters_timeout, I shortened the time to wait for listener filters to complete from 15 seconds (the default) to 1 second. With continue_on_listener_filters_timeout set to true, the connection is maintained even after the timeout.
The configuration is updated with update-proxy-configuration.
aws elb-proxy update-proxy-configuration --proxy-identifier <PROXY-ARN> --cli-binary-format raw-in-base64-out --configuration-file configurationBytes@=file://envoy.yaml
After propagationStatus became complete, I tried connecting and confirmed that I could connect to the DB.
Results after the update. The ON rows were measured after setting require_secure_transport back to ON.
| require_secure_transport | --ssl-mode | Result | Elapsed time |
|---|---|---|---|
| OFF | VERIFY_CA | Connected (8.4.12, TLSv1.3) | 1.264 s |
| OFF | DISABLED | Connected (Ssl_version is empty) | 1.044 s |
| ON | VERIFY_CA | Connected (8.4.12, TLSv1.3) | 1.094 s |
| ON | DISABLED | Rejected by Aurora (ERROR 3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON.) | 1.033 s |
Cause
ELB for Envoy places a TLS Inspector with JA3 and JA4 fingerprinting enabled as a listener filter at the head of every listener.
The TLS Inspector waits for the client's first bytes. In MySQL, the server sends data first, and the client waits for that packet. The proxy does not connect to Aurora until the listener filters finish, so both sides keep waiting, 15 seconds pass, and the listener filter times out. When continue_on_listener_filters_timeout is set to true, the connection is maintained after the timeout and proceeds to tcp_proxy, which allowed the DB connection.
In PostgreSQL, the client sends data first, so the connection moves from the TLS Inspector to tcp_proxy without delay, and it connected.
Envoy logs
Access log
When open_telemetry is placed in the access_log of tcp_proxy, one log entry arrives in CloudWatch Logs each time a connection closes. For body and attributes, I specified command operators usable for TCP connections (such as %START_TIME%). connection_termination_details and requested_server_name were -, and the other fields had values.
Sending to logs.ap-northeast-1.amazonaws.com worked via the NAT gateway.
The full text of one PostgreSQL TLS connection (IPs and resource IDs are masked).
{"resource":{"attributes":{"log_name":"access","zone_name":"ap-northeast-1a","cluster_name":"elbdb-verify","node_name":"<ENI-ID>","service.name":"elb-for-envoy-db-verify"}},"timeUnixNano":1795758122106721000,"observedTimeUnixNano":0,"severityNumber":0,"severityText":"","body":"[2026-11-27T05:42:02.106Z] postgres <client-ip>:48630 -> <db-ip>:5432 rx=1589 tx=4454 duration=132ms flags=UR","attributes":{"engine":"postgres","start_time":"2026-11-27T05:42:02.106Z","downstream_remote_address":"<client-ip>:48630","upstream_cluster":"aurora_postgres","upstream_host":"<db-ip>:5432","bytes_received":"1589","bytes_sent":"4454","duration_ms":"132","response_flags":"UR","connection_termination_details":"-","requested_server_name":"-"},"traceId":"","spanId":""}
Process log
If you set the proxy attribute envoy.log_level to debug, the process log outputs lines for each connection.
aws elb-proxy update-proxy-attributes --proxy-identifier <PROXY-ARN> --attributes key=envoy.log_level,value=debug
The log group is /aws/elb-proxy/<proxy name>. The first debug line appeared about 6 seconds after the update (14:45:55 → 14:46:01, JST). With debug, lines unrelated to connections, such as health checks and DNS refreshes, keep appearing, amounting to about 1,600 lines in 15 seconds. Extract connection lines by ConnectionId. The timestamp of CloudWatch Logs events is about 1 second later than the time in the message, so when retrieving by time range, set the end time a few seconds later.
For one PostgreSQL TLS connection (one select version() SQL), 36 lines were output for that connection. The breakdown is 17 filter lines, 8 pool lines, 8 connection lines, 2 conn_handler lines, and 1 router line. Here are the 8 main lines (IPs are masked).
[2026-11-27 05:46:10.450][2450][debug][filter] [external/envoy+/source/extensions/filters/listener/tls_inspector/tls_inspector.cc:193] tls inspector: parseClientHello failed: 0, 0: TLS_error|error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:TLS_error_end
[2026-11-27 05:46:10.451][2450][debug][filter] [external/envoy+/source/common/tcp_proxy/tcp_proxy.cc:451] [Tags: "ConnectionId":"1726"] new tcp proxy session
[2026-11-27 05:46:10.451][2450][debug][filter] [external/envoy+/source/common/tcp_proxy/tcp_proxy.cc:720] [Tags: "ConnectionId":"1726"] Creating connection to cluster aurora_postgres
[2026-11-27 05:46:10.451][2450][debug][connection] [external/envoy+/source/common/network/connection_impl.cc:1177] [Tags: "ConnectionId":"1727"] connecting to <db-ip>:5432
[2026-11-27 05:46:10.453][2450][debug][connection] [external/envoy+/source/common/network/connection_impl.cc:869] [Tags: "ConnectionId":"1727"] connected
[2026-11-27 05:46:10.453][2450][debug][router] [external/envoy+/source/common/tcp_proxy/upstream.cc:372] Attached upstream connection [C1727] to downstream connection [C1726]
[2026-11-27 05:46:10.453][2450][debug][filter] [external/envoy+/source/common/tcp_proxy/tcp_proxy.cc:1117] [Tags: "ConnectionId":"1726"] onData: received 8 bytes, end_stream=false, has upstream true, receive_before_connect_=false, connect_mode_=0
[2026-11-27 05:46:10.509][2450][debug][filter] [external/envoy+/source/common/tcp_proxy/tcp_proxy.cc:1117] [Tags: "ConnectionId":"1726"] onData: received 0 bytes, end_stream=true, has upstream true, receive_before_connect_=false, connect_mode_=0
As the first line shows, the TLS Inspector fails to parse the ClientHello, and the connection proceeds to tcp_proxy as is. This is because the first 8 bytes from PostgreSQL are not a TLS ClientHello. The onData lines show only the number of bytes received, not the contents of SQL or passwords.
For the MySQL connection with the timeout set to 1 second (TLS, one select version() SQL), 36 lines were output for that connection. The first 4 lines are as follows, showing the connection proceeding after the timeout. The tls inspector: parseClientHello failed line does not appear.
[2026-11-27 06:48:38.358][5384][debug][conn_handler] [external/envoy+/source/common/listener_manager/active_tcp_socket.cc:58] listener filter times out after 1000 ms
[2026-11-27 06:48:38.358][5384][debug][conn_handler] [external/envoy+/source/common/listener_manager/active_tcp_socket.cc:61] fallback to default listener filter
[2026-11-27 06:48:38.358][5384][debug][filter] [external/envoy+/source/common/tcp_proxy/tcp_proxy.cc:451] [Tags: "ConnectionId":"185"] new tcp proxy session
[2026-11-27 06:48:38.358][5384][debug][filter] [external/envoy+/source/common/tcp_proxy/tcp_proxy.cc:690] [Tags: "ConnectionId":"185"] establishUpstreamConnection called: cluster_name=aurora_mysql, route_=true
Summary
The ELB for Envoy announcement does not mention support for DB connections. I confirmed that a TCP listener (tcp_proxy) can relay DB connections to Aurora (PostgreSQL-compatible).
MySQL did not work as a proxy with the default settings, but by investigating the proxy logs and configuring the connection to be maintained after the filter timeout, I was able to connect to the DB. For workloads that can tolerate connection delays and where connections are infrequent, ELB for Envoy may be usable.
If you need a MySQL proxy right now, I recommend choosing one that explicitly advertises MySQL support.
