AWS Cloudformation: AWS Certificate Manager To import SSL

amazon-cloudformationamazon-web-services

Can you import an existing certificate using ACM to be used by your LoadBalancerListener via CloudFormation?

On ACM FAQ, it does not tell it can be done on cloudformation concerning the importing of SSL.

Q: Can I import a third party certificate and use it with AWS services?

Yes. If you want to use a third-party certificate with Amazon CloudFront or Elastic Load Balancing, you may import it into ACM using the AWS Management Console, AWS CLI, or AWS Certificate Manager APIs. ACM does not manage the renewal process for imported certificates. You can use the AWS Management Console to monitor the expiration dates of an imported certificates and import a new third-party certificate to replace an expiring one.

As for the cloudformation documentation concerning the ACM. It doesn't provide properties to import an existing certificate to be used on my stack based on the below properties

Type: "AWS::CertificateManager::Certificate"
Properties: 
    DomainName: String
    DomainValidationOptions:
      - DomainValidationOptions
    SubjectAlternativeNames:
      - String
    Tags:
      - Resource Tag

Best Answer

You can import the cert into ACM at first, and then provide Certificate ARN as the Parameters of ELB in the CF template.

following an example of CF:

Parameters:
        "CerttificationArn": {
            "Default": "",
            "Description": "ARN for the Certificate",
            "Type": "String"
        },

ELB:

....
                "Listeners": [
                    {
                        "LoadBalancerPort": "80",
                        "InstancePort": "80",
                        "Protocol": "HTTP"
                    },
                    {
                        "LoadBalancerPort": "443",
                        "Protocol": "HTTPS",
                        "InstancePort": "443",
                        "InstanceProtocol": "HTTPS",
                        "PolicyNames": [ "SSL-Policy" ],
                        "SSLCertificateId": { "Ref": "CerttificationArn" }
                    }
...