View a markdown version of this page

AWS::ElasticLoadBalancingProxy::CertificateAssociation - AWS CloudFormation

This is the new CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.

AWS::ElasticLoadBalancingProxy::CertificateAssociation

Associates an AWS Certificate Manager (ACM) certificate with an Elastic Load Balancing for Envoy proxy so that the proxy can terminate TLS with it.

When the association is active, the certificate is available to the proxy. To serve the certificate, you must also reference it by its ARN in a listener in the proxy's configuration file. The proxy supplies the certificate at runtime, so you don't embed the private key in your configuration.

If an earlier association of the same proxy and certificate failed, remove the failed association with the DisassociateCertificate operation before you create this resource again. While the failed association exists, CloudFormation reports that the resource already exists.

Associate the certificate before you reference it in the proxy's configuration file. A listener that references a certificate that isn't associated with the proxy doesn't start. If you create a proxy and its certificate association in the same template, don't reference the certificate in the proxy's configuration file at create time. After the association is active, update the proxy's ConfigurationFile to reference the certificate by its ARN.

If you remove the association outside CloudFormation, for example with the DisassociateCertificate operation, drift detection reports the resource as DELETED. A stack update doesn't re-create it. To re-create it, remove the resource from your template and update the stack, then add it back and update again.

A proxy can have at most 25 associated certificates. Associations that are active or associate-in-progress count toward this limit. Creating one more association fails with ServiceLimitExceeded.

Changing CertificateArn replaces the association. CloudFormation creates the new association before it deletes the old one. To swap certificates, add the new association in one stack update and remove the old one in a later update.

For more information, see Terminate TLS with an ACM certificate in the Elastic Load Balancing for Envoy User Guide.

Syntax

To declare this entity in your CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::ElasticLoadBalancingProxy::CertificateAssociation", "Properties" : { "CertificateArn" : String, "ProxyArn" : String } }

YAML

Type: AWS::ElasticLoadBalancingProxy::CertificateAssociation Properties: CertificateArn: String ProxyArn: String

Properties

CertificateArn

The Amazon Resource Name (ARN) of the ACM certificate to associate with the proxy. The certificate must be in the same AWS account and Region as the proxy. If the certificate is in another account, the association fails because the certificate isn't found.

Elastic Load Balancing for Envoy associates the certificate by using your credentials. You need permission to call acm:CreateCertificateRelation on the certificate.

Required: Yes

Type: String

Pattern: ^arn:[a-z0-9\-]+:acm:[a-z0-9\-]+:[0-9]{12}:certificate/.+$

Minimum: 1

Maximum: 512

Update requires: Replacement

ProxyArn

The ARN of the proxy to associate the certificate with. The proxy must be in the same AWS account and Region as the stack.

Required: Yes

Type: String

Pattern: ^arn:[a-z-]+:elasticloadbalancing:[a-z0-9-]+:[0-9]{12}:proxy/[a-zA-Z0-9-]+:[a-zA-Z0-9]+$

Minimum: 1

Maximum: 2048

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the identifier of the certificate association, such as arn:aws:elasticloadbalancing:us-east-1:123456789012:proxy/my-proxy:0123456789abcdef/certificate/12345678-1234-1234-1234-123456789012.

CloudFormation uses this identifier only. No Elastic Load Balancing for Envoy API accepts it.

For more information, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information, see Fn::GetAtt.

Arn

The identifier of the certificate association. This value isn't an ARN that Elastic Load Balancing for Envoy issues, and no Elastic Load Balancing for Envoy API accepts it.

CertificateId

The ID of the ACM certificate, taken from the certificate ARN.

CreatedAt

The date and time when the association was created.

ProxyId

The ID of the proxy, taken from the proxy ARN.

ProxyName

The name of the proxy, taken from the proxy ARN.

Status

The status of the association. Valid values are the following:

  • associate-in-progress – The certificate is being associated with the proxy.

  • active – The certificate is associated and available to the proxy.

  • associate-failed – The certificate couldn't be associated with the proxy.

  • disassociate-in-progress – The certificate is being removed from the proxy.

  • disassociated – The certificate isn't associated with the proxy.

After CloudFormation creates the association, the status is active. CloudFormation treats an association in disassociate-in-progress or disassociated as deleted.

Examples

Example - Associate an ACM certificate with a proxy

The following example creates a proxy and associates an ACM certificate with it. The proxy's configuration file doesn't reference the certificate, because CloudFormation creates the association after the proxy. After you create the stack, update the configuration file to add a TLS listener that references the certificate ARN. For a sample listener, see Terminate TLS with an ACM certificate in the Elastic Load Balancing for Envoy User Guide.

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { "ProxyRoleArn": { "Type": "String", "Description": "ARN of the proxy role" }, "SubnetIds": { "Type": "List<AWS::EC2::Subnet::Id>", "Description": "At least two subnets in different Availability Zones of the same VPC" }, "SecurityGroupId": { "Type": "AWS::EC2::SecurityGroup::Id", "Description": "Security group for the proxy" }, "CertificateArn": { "Type": "String", "Description": "ARN of an ACM certificate in the same account and Region" } }, "Resources": { "Proxy": { "Type": "AWS::ElasticLoadBalancingProxy::Proxy", "Properties": { "Name": "my-proxy", "Type": "envoy", "ProxyVersion": "1.40", "RoleArn": { "Ref": "ProxyRoleArn" }, "IpAddressingConfiguration": { "Ipv4Addressability": "internal", "Ipv6Addressability": "off" }, "Subnets": { "Ref": "SubnetIds" }, "SecurityGroups": [ { "Ref": "SecurityGroupId" } ], "ConfigurationFile": { "ConfigurationBytes": { "Fn::Base64": "admin:\n address:\n socket_address:\n address: 127.0.0.1\n port_value: 9901\n\nstatic_resources:\n listeners:\n - name: listener_0\n address:\n socket_address:\n address: 0.0.0.0\n port_value: 80\n filter_chains:\n - filters:\n - name: envoy.filters.network.http_connection_manager\n typed_config:\n \"@type\": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager\n stat_prefix: ingress_http\n route_config:\n name: local_route\n virtual_hosts:\n - name: local_service\n domains: [\"*\"]\n routes:\n - match:\n prefix: \"/\"\n direct_response:\n status: 200\n body:\n inline_string: \"Hello from ELB for Envoy\\n\"\n http_filters:\n - name: envoy.filters.http.router\n typed_config:\n \"@type\": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router\n" } }, "Attributes": [ { "Key": "envoy.log_level", "Value": "info" } ], "Tags": [ { "Key": "environment", "Value": "test" } ] } }, "CertificateAssociation": { "Type": "AWS::ElasticLoadBalancingProxy::CertificateAssociation", "Properties": { "ProxyArn": { "Ref": "Proxy" }, "CertificateArn": { "Ref": "CertificateArn" } } } }, "Outputs": { "CertificateAssociationStatus": { "Value": { "Fn::GetAtt": [ "CertificateAssociation", "Status" ] } } } }

YAML

AWSTemplateFormatVersion: '2010-09-09' Parameters: ProxyRoleArn: Type: String Description: ARN of the proxy role SubnetIds: Type: List<AWS::EC2::Subnet::Id> Description: At least two subnets in different Availability Zones of the same VPC SecurityGroupId: Type: AWS::EC2::SecurityGroup::Id Description: Security group for the proxy CertificateArn: Type: String Description: ARN of an ACM certificate in the same account and Region Resources: Proxy: Type: AWS::ElasticLoadBalancingProxy::Proxy Properties: Name: my-proxy Type: envoy ProxyVersion: '1.40' RoleArn: Ref: ProxyRoleArn IpAddressingConfiguration: Ipv4Addressability: internal Ipv6Addressability: 'off' Subnets: Ref: SubnetIds SecurityGroups: - Ref: SecurityGroupId ConfigurationFile: ConfigurationBytes: Fn::Base64: | 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 Attributes: - Key: envoy.log_level Value: info Tags: - Key: environment Value: test CertificateAssociation: Type: AWS::ElasticLoadBalancingProxy::CertificateAssociation Properties: ProxyArn: Ref: Proxy CertificateArn: Ref: CertificateArn Outputs: CertificateAssociationStatus: Value: Fn::GetAtt: [CertificateAssociation, Status]