我在代码中尝试了以下内容
alb = aws_elasticloadbalancingv2.CfnLoadBalancer(
self,
id=self.id,
name=load_balancer_name,
load_balancer_attributes=cfn_alb_props,
security_groups=security_groups,
subnets=self.subnets
)
target = aws_route53.RecordTarget.from_alias(aws_route53_targets.LoadBalancerTarget(alb))
hosted_zone = aws_route53.HostedZone.from_hosted_zone_attributes(self, "route53-hosted-zone-id",
hosted_zone_id=hosted_zone_id, zone_name="route53-hosted-zone-name")
aws_route53.ARecord(self, 'AliasRecord',
target=target,
zone=hosted_zone)
我在控制台上遇到以下错误
jsii.errors.JavaScriptError:
Error: Resolution error: Supplied properties not correct for "CfnRecordSetProps"
aliasTarget: supplied properties not correct for "AliasTargetProperty"
dnsName: required but missing
hostedZoneId: required but missing.
我猜我在创建alb时缺少了dnsName
和hostedZoneId
吗?我尝试查看AWS CDK参考指南中有关如何将其传递给我的更多信息,但是它并没有完全有用,并且在任何地方都没有这样做的示例