Open janschloss opened 2 years ago
Yes I think this is where the critical bug is https://github.com/aws/aws-cdk/blob/beaa5b2559b81e799a731cd680831699518de286/packages/%40aws-cdk/aws-cloudfront/lib/distribution.ts#L308
Seems that by default it takes the top level domain rather than one from the "domains" attribute
Solution
I figured out if you put the record name as the subdomain you wish to connect to it should work out ok.
new route53.ARecord(this, "AliasRecord", {
zone: hostedZone,
recordName: "sub.domain.com",
target: route53.RecordTarget.fromAlias(
new alias.CloudFrontTarget(distribution)
)
});
}
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Don't think this is fixed yet
This is not fixed and very misleading.
What is the problem?
Hello,
when trying to create an ARecord with an HTTP API alias on a subdomain, the record is created with the general domain instead.
Reproduction Steps
What did you expect to happen?
I expected an A Record like this in Route53:
api.example.com | A | Simple | - | alias.....
What actually happened?
An A Record to the general domain was created:
example.com | A | Simple | - | alias.....
CDK CLI Version
1.130.0 (build 9c094ae)
Framework Version
No response
Node.js Version
v14.18.0
OS
Windows
Language
Typescript
Language Version
No response
Other information
No response