我有一个在 AWS Route53 中注册的现有域名,并且我在 API Gateway 中设置了一个自定义域名。在控制台中,我可以从外部配置诸如 xxxxxx.zenxxxxxxfoundry.com 之类的东西,实际上到达 API Gateway API,然后到达我的 Lambda 函数。
现在我想用 AWS CDK 来实现这一点。
我尝试了以下方法:
const zone = route53.HostedZone.fromHostedZoneId(this, 'ZenithWebFoundryZone', 'ZXXXXXX04V8134');
new route53.AliasRecord(this, 'BlogAPIRecord', {
zone: zone,
recordName: 'xxxxxx.zenxxxxxxfoundry.com',
target: {
bind: (): route53.AliasRecordTargetProps => ({
dnsName: 'd-xxxxxxy00g.execute-api.ap-southeast-2.amazonaws.com',
hostedZoneId: 'ZXXXXXX04V8134'
})
}
});
可以构建npm run build
,但是当我运行时,cdk synth
我得到了相当迟钝的错误:
$ cdk synth
HostedZone.fromHostedZoneId doesn't support "zoneName"
Subprocess exited with error 1
打开--trace
并没有太大帮助:附加信息:
Error: Subprocess exited with error 1
at ChildProcess.proc.on.code (/Users/mikecoxon/.npm-packages/lib/node_modules/aws-cdk/lib/api/cxapp/exec.ts:108:23)
at ChildProcess.emit (events.js:189:13)
at ChildProcess.EventEmitter.emit (domain.js:441:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
我查看了整个堆栈脚本,没有zoneName
任何地方引用。有谁知道这个错误来自哪里?