Description
Set the ACM DomainName to the hostname the certificate must cover. A bare * is invalid. A wildcard such as *.example.com covers one level, including api.example.com. Include the apex example.com separately if needed.
Potential impact
Invalid names prevent issuance. Sharing a wildcard certificate across services increases the number of services to check when replacing it.
Remediation
For automatic DNS validation, match the domain in DomainValidationOptions to the requested name and supply the HostedZoneId of its public Route 53 zone in the same AWS account. After issuance, verify that the certificate covers the intended names.
Examples
The first template uses * for the request and a parameter for validation. The second references DomainName in both places. Replace the default api.example.com with a domain you control.
Before
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
DomainName:
Description: "Domain for the certificate request"
Type: String
Default: api.example.com
HostedZoneId:
Description: "Public hosted zone ID for the DNS validation record"
Type: String
Resources:
Certificate:
Type: AWS::CertificateManager::Certificate
Properties:
DomainName: "*"
DomainValidationOptions:
- DomainName: !Ref DomainName
HostedZoneId: !Ref HostedZoneId
ValidationMethod: DNS
After
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
DomainName:
Description: "Domain for the certificate request"
Type: String
Default: api.example.com
HostedZoneId:
Description: "Public hosted zone ID for the DNS validation record"
Type: String
Resources:
Certificate:
Type: AWS::CertificateManager::Certificate
Properties:
DomainName: !Ref DomainName
DomainValidationOptions:
- DomainName: !Ref DomainName
HostedZoneId: !Ref HostedZoneId
ValidationMethod: DNS