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'

Shane
feita há 5 meses290 visualizações
1 Resposta
0
Resposta aceita

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
respondido há 5 meses
profile picture
ESPECIALISTA
avaliado há 5 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas