amazon-web-services - 如何为 AWS::ElasticLoadBalancingV2::Listener 设置多个证书

标签 amazon-web-services ssl listener aws-cloudformation

您好,我在为 ALB 监听器设置多个证书时遇到问题。 这是我的 CF 模板的片段:

  DiscoveryListenerHTTPS:
    Type: AWS::ElasticLoadBalancingV2::Listener
    DependsOn:
      - DiscoveryLoadBalancer
      - DiscoveryLoadBalancerTargetGroup
    Properties:
      Certificates:
       - CertificateArn: !Ref CertificateArn1
       - CertificateArn: !Ref CertificateArn2

响应是: 最多可以指定“1”个证书 ARN,但指定了“2”个(服务:AmazonElasticLoadBalancingV2;状态代码:400;错误代码:TooManyCertificates;请求 ID:XXXXXXXXX)

最佳答案

编辑:由于@chris-pollard 和@adamkgray 的回答改进了答案

这对我有用,您可以为 HTTPS 监听器指定多个 SSL 证书。

对于 HTTPS,您不能在AWS::ElasticLoadBalancingV2::Listener 上直接指定多个证书。资源。 相反,您必须创建一个 AWS::ElasticLoadBalancingV2::ListenerCertificate模板中的资源以获取其他证书。

以下是 443 端口监听器的示例,该监听器使用默认证书,然后是包含至少一个证书并与之前创建的监听器关联的证书列表:

Listener443:
    DependsOn:
    - LoadBalancer
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      Certificates:
        - CertificateArn: !Ref CertificateARN
      LoadBalancerArn: !Ref LoadBalancer
      DefaultActions:
        - Type: fixed-response
          FixedResponseConfig:        
            ContentType: text/plain
            MessageBody: "Not Found"
            StatusCode: 404
      Port: 443
      Protocol: HTTPS

  CertificatesList:
    Type: AWS::ElasticLoadBalancingV2::ListenerCertificate
    Properties: 
      Certificates: 
        - CertificateArn: !Ref CertificateARN2
      ListenerArn: !Ref Listener443

关于amazon-web-services - 如何为 AWS::ElasticLoadBalancingV2::Listener 设置多个证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54447250/

相关文章:

ruby - 在 Ruby DBI 模块中与 postgresql 进行 ssl 通信

ios - 在 iOS 应用程序中选择退出 App Transport Security 功能

authentication - Nginx 代理通过证书向 MS IIS 进行身份验证

android - 从Android中的事件处理方法返回的 bool 值是什么意思

amazon-web-services - 如何使用 STSAssumeRoleSessionCredentialsProvider 和 roleSessionName 和 roleArn 为 AWS SDK for Java 2.x 进行配置?

amazon-web-services - AWS Cognito 用户池应用程序客户端中的设置意味着什么

java - Dynamodb 写入操作

swing - Scala Swing 中的听众和 react

Java/JavaFX2 : dynamic GUI, 检测哪个按钮被按下,提取id

amazon-web-services - 并行启动多个 EC2 实例