amazon-elastic-beanstalk - Cloudformation 模板的 ACM 证书验证失败

标签 amazon-elastic-beanstalk aws-cloudformation aws-acm aws-route53

我正在部署带有 Beanstalk 实例AWS Cloudformation 堆栈 Routes53 记录ACM 证书

我想在堆栈部署期间立即通过 DNS 验证验证证书。

当我运行和部署堆栈时,除了持续处于验证等待状态的 ACM 证书之外,所有资源均已正确创建。验证等待。我没有任何错误,而且我不太明白为什么证书没有经过验证。

我的cloudformation模板看起来像这样:

AWSTemplateFormatVersion: "2010-09-09"
Description: Project beanstalk

Parameters:
  ApplicationName:
    Description: Name of your application
    Type: String
    Default: hello
    MinLength: 1
    MaxLength: 255
    AllowedPattern: "^[a-zA-Z][-a-zA-Z0-9]*$"

  EnvironmentName:
    Description: Environment name, either dev or rec or main
    Type: String
    Default: dev
    AllowedValues:
      - dev
      - rec
      - main
    ConstraintDescription: Specify either dev or rec or main

Resources:
  Application:
    Type: AWS::ElasticBeanstalk::Application
    Properties:
      ApplicationName: !Ref ApplicationName

  Environment:
    Type: AWS::ElasticBeanstalk::Environment
    Properties:
      ApplicationName: !Ref Application
      EnvironmentName: !Sub "${ApplicationName}-${EnvironmentName}"
      TemplateName: !Ref ConfigurationTemplate # I disable this part to limit code lines
    DependsOn:
      - ConfigurationTemplate

  Route53APIRecordSet:
    Type: "AWS::Route53::RecordSet"
    Properties:
      Name: !Sub "${ApplicationName}-${EnvironmentName}.api.hello.com"
      Type: "A"
      HostedZoneId: !Ref HostedZoneIdFromMyDNS # This var is hard code in my template
      AliasTarget:
        DNSName: !GetAtt Environment.EndpointURL
        HostedZoneId: !Ref HostedZoneIdFromMyBeanstalk # ELB Zone ID for my region (it's also hardcoded)

  APIACMCertificate:
    Type: "AWS::CertificateManager::Certificate"
    Properties:
      DomainName: hello.com
      ValidationMethod: DNS
      DomainValidationOptions:
        - DomainName: !Sub "${ApplicationName}-${EnvironmentName}.api.hello.com"
          HostedZoneId: !Ref HostedZoneIdFromMyDNS

我不明白为什么我的 Routes53 记录ACM 证书未正确验证。你有好主意吗 ? 我的 Routes53 记录设置正确,因为我可以导航到我的 beanstalk 页面,但不能导航到证书下。

编辑 2023 年 8 月 8 日 我运行 2 个 nslookup 命令(这些命令是个性化的,如上面的示例):

  • nslookup hello.com 响应是:非权威答案,服务器未知

  • nslookup ${ApplicationName}-${EnvironmentName}.api.hello.com(参数当然会改变)。服务器也不知道,但我没有非权威的答案。

最佳答案

两个 DomainName: 指令在文档中必须具有相同的值。 AWS::CertificateManager::Certificate cloudfront docs

In order for a AWS::CertificateManager::Certificate to be provisioned and validated in CloudFormation automatically, the DomainName property needs to be identical to one of the DomainName property supplied in DomainValidationOptions, if the ValidationMethod is DNS.

关于amazon-elastic-beanstalk - Cloudformation 模板的 ACM 证书验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76847880/

相关文章:

amazon-web-services - Cloudformation 中的循环依赖

amazon-web-services - AWS ECS 服务创建(Ec2 Launch 类型)保持“Create IN Progress”状态并在回滚后显示“Create Failed”状态

aws-cloudformation - ECS 服务使用 ALB 的权限问题

amazon-web-services - ACM 如何使用 CNAME 记录检查域所有权?

amazon-web-services - 将 Porkbun TLS 证书导入 AWS ACM

amazon-web-services - aws_beanstalk/ubuntu 的拉取访问被拒绝

ruby-on-rails - 如何在 Elastic Beanstalk 启动时守护 Rails Rake 任务

amazon-web-services - Amazon Elastic Beanstalk 配置问题

ruby-on-rails - Elastic Beanstalk,Bundler 找不到 gem "bundler"的兼容版本