Using AWS Certificate Manager (ACM Certificate) with Elastic Beanstalk

后端 未结 4 1428
深忆病人
深忆病人 2020-12-09 11:22

When you have a certificate for your domain issued through AWS Certificate Manager, how do you apply that certificate to an Elastic Beanstalk application.

Yes, the E

4条回答
  •  不思量自难忘°
    2020-12-09 12:08

    You can do this purely with CloudFormation; however, as seems to be quite common with Elastic Beanstalk the configuration options are much harder to find in the docs than they are for the individual components that comprise Elastic Beanstalk. The info is here:

    http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general-elbloadbalancer

    But basically what you need to do is add the creation of the cert to your template and then reference it in OptionSettings in AWS::ElasticBeanstalk::ConfigurationTemplate:

    "Certificate" : {
          "Type": "AWS::CertificateManager::Certificate",
          "Properties": {
            "DomainName": "example.com",
          }
        },
    // ...
    "ElasticbeanstalkTemplate": {
          "Type": "AWS::ElasticBeanstalk::ConfigurationTemplate",
          "Properties": {
            "SolutionStackName": "MyEBStack",
            "ApplicationName": "MyAppName",
            "Description": "",
            "OptionSettings": [{
              "Namespace": "aws:elb:listener:443",
              "OptionName": "InstancePort",
              "Value": "80"
            }, {
              "Namespace": "aws:elb:listener:443",
              "OptionName": "InstanceProtocol",
              "Value": "HTTP"
            }, {
              "Namespace": "aws:elb:listener:443",
              "OptionName": "ListenerProtocol",
              "Value": "HTTPS"
            }, {
              "Namespace": "aws:elb:listener:443",
              "OptionName": "SSLCertificateId",
              "Value": {
                "Ref": "Certificate"
              }
            }, /*More settings*/]
    

提交回复
热议问题