How do I associate multiple ACM SSL or TLS certificates with Application Load Balancer using CloudFormation?

Last updated: 2022-04-15

I want to associate multiple AWS Certificate Manager SSL and TLS certificates with Application Load Balancer using AWS CloudFormation.

Short description

To add a default SSL server for a secure listener, use the Certificates property for the resource AWS::ElasticLoadBalancingV2::Listener. This resource provides one certificate. To add more certificates, use AWS::ElasticLoadBalancingV2::ListenerCertificate. AWS::ElasticLoadBalancingV2::ListenerCertificate includes the Certificates parameter that accepts the list of certificates.

Resolution

Use the following CloudFormation template to create an Application Load Balancer listener with one default certificate:

HTTPlistener:
  Type: 'AWS::ElasticLoadBalancingV2::Listener'
  DependsOn: ApplicationLoadBalancer
  Properties:
    DefaultActions:
      - Type: fixed-response
        FixedResponseConfig:
          ContentType: text/plain
          MessageBody: Success
          StatusCode: '200'
    LoadBalancerArn: >-
      arn:aws:elasticloadbalancing:<Region>:<AccountID>:loadbalancer/app/TestACMELB/1032d48308c9b37f
    Port: '443'
    Protocol: HTTPS
    Certificates:
      - CertificateArn: >-
          arn:aws:acm:<Region>:<AccountID>:certificate/cffb8a69-0817-4e04-bfb1-dac7426d6b90

Use the following CloudFormation template to add multiple certificates to the Application Load Balancer listener:

AdditionalCertificates:
  Type: 'AWS::ElasticLoadBalancingV2::ListenerCertificate'
  DependsOn: HTTPlistener
  Properties:
    Certificates:
      - CertificateArn: >-
          arn:aws:acm:<Region>:<AccountID>:certificate/c71a3c29-e79d-40e6-8834-650fe0d54a3f
      - CertificateArn: >-
          arn:aws:acm:<Region>:<AccountID>:certificate/fff1c1ba-3d97-4735-b3d5-9c5269b75db3
    ListenerArn:
      Ref: HTTPlistener

Did this article help?


Do you need billing or technical support?