Terminate TLS with an ACM certificate
With Elastic Load Balancing for Envoy (ELB for Envoy), you can terminate TLS on your proxy with a certificate from AWS Certificate Manager (ACM). You associate the certificate with the proxy, then update the proxy configuration so that a listener references the certificate by its ARN. The proxy supplies the certificate at runtime, so you don't embed the private key in your configuration.
Prerequisites
Before you terminate TLS with an ACM certificate, make sure that you have the following:
-
A certificate in ACM, in the same account and AWS Region as the proxy.
-
The ARN of an existing proxy.
-
Permission to call
acm:CreateCertificateRelationon the certificate. ELB for Envoy associates the certificate using your credentials.
Associate the certificate
Associate the certificate with your proxy using the console or the AWS CLI. Choose the
tab for the method that you want to use. You can't associate a certificate by using CloudFormation. The
association starts in the
associate-in-progress state. When its status is active, the certificate
is available to the proxy and you can reference it in your configuration.
Reference the certificate in a listener
After the certificate association is active, reference the certificate in the
listener's DownstreamTlsContext. Name the certificate by its ARN in
common_tls_context.tls_certificate_sds_secret_configs. ELB for Envoy supplies the
certificate, so the entry has no sds_config.
Fragment:
transport_socket: name: envoy.transport_sockets.tls typed_config: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext common_tls_context: tls_certificate_sds_secret_configs: - name: "arn:aws:acm:us-east-1:123456789012:certificate/11111111-2222-3333-4444-555555555555"
Replace the example certificate ARN with the ARN of your associated certificate.
After you update the listener, apply the updated configuration. For instructions, see Update a proxy configuration.
Complete sample configuration
The following Envoy configuration listens on port 443, terminates TLS with an ACM certificate, and responds with a fixed string. Associate the certificate with your proxy before you apply the configuration.
admin: address: socket_address: address: 127.0.0.1 port_value: 9901 static_resources: listeners: - name: https_listener address: socket_address: address: 0.0.0.0 port_value: 443 filter_chains: - transport_socket: name: envoy.transport_sockets.tls typed_config: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext common_tls_context: tls_certificate_sds_secret_configs: - name: "arn:aws:acm:us-east-1:123456789012:certificate/11111111-2222-3333-4444-555555555555" 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_https route_config: name: local_route virtual_hosts: - name: local_service domains: ["*"] routes: - match: prefix: "/" direct_response: status: 200 body: inline_string: "Your proxy is running with an ACM certificate\n" http_filters: - name: envoy.filters.http.router typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
Replace the example certificate ARN with the ARN of your associated certificate.
Test the certificate
To test the proxy, send a request for a domain name on your certificate with the following
curl command. The --connect-to option sends the request to the
proxy without a DNS change.
curl -v --connect-to www.example.com:443:<proxy-dns-name>:443 https://www.example.com/
Replace www.example.com with a domain name on your certificate,
and replace proxy-dns-name with the proxy's dnsName from
get-proxy.
The output includes the certificate the proxy presents and the response.
* Server certificate: * subject: CN=www.example.com * subjectAltName: "www.example.com" matches cert's "www.example.com" < HTTP/1.1 200 OK < content-length: 46 < content-type: text/plain < server: envoy Your proxy is running with an ACM certificate
Disassociate the certificate
When you no longer need a certificate on your proxy, disassociate it using the console or the AWS CLI. Choose the tab for the method that you want to use. You can't disassociate a certificate by using CloudFormation.