How do I assign multiple domains to a certificate created using cloudformation

0

When manually creating a certificate using the console, I can add multiple domain names, so I get a cert for "example.com" as well as "*.example.com". The certificate arn is to be used by a Cloudfront distribution for an S3 backed site.

How do I do this using cloudformation? or does this have to be a manual step?

Parameters:
  RootDomainName:
    Description: Domain name for your website (example.com)
    Type: String
  HostedZoneId:
    Description: The route53 zone id of the domain
    Type: String

Resources:
  SiteCert:
    Type: AWS::CertificateManager::Certificate
    Properties:
      DomainName: !Ref RootDomainName   # + *.RootDomainName
      DomainValidationOptions:
        - DomainName: !Ref RootDomainName
          HostedZoneId: !Ref HostedZoneId
      ValidationMethod: 'DNS'

1개 답변
0
수락된 답변

I found the answer - you set SubjectAlternativeNames to add the extra names to the cert.

Resources:
  SiteCert:
    Type: AWS::CertificateManager::Certificate
    Properties:
      DomainName: !Ref RootDomainName
      DomainValidationOptions:
        - DomainName: !Ref RootDomainName
          HostedZoneId: !Ref HostedZoneId
      SubjectAlternativeNames:
        - !Sub
          - www.${Domain}
          - Domain: !Ref RootDomainName
      ValidationMethod: 'DNS'
Shane
답변함 5달 전
profile picture
전문가
검토됨 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠