我可以在Route53中创建一个记录:

但是当我用cdk代码做同样的事情时。失败了。这是“守则”:
// ALB names are limited to 32 characters...workaround
let lbNameLength = 28
let truncatedServiceName = props.serviceName.substring(0, lbNameLength)
// Creating an internet facing ALB
const loadBalancer = new elbv2.ApplicationLoadBalancer(this, "alb", {
vpc: props.cluster.vpc,
vpcSubnets: {
subnets: props.cluster.vpc.privateSubnets
},
loadBalancerName: `${truncatedServiceName}-lb`,
idleTimeout: Duration.seconds(3600)
});
// Allowing incoming connections
loadBalancer.connections.allowFromAnyIpv4(ec2.Port.tcp(props.lbPort), "Allow inbound HTTP");
// Creating a listener and listen to incoming requests
const listener = loadBalancer.addListener("listener", {
port: props.lbPort,
protocol: elbv2.ApplicationProtocol.HTTP
});
// Creating a target group that points to the application container (e.g. port 8080)
listener.addTargets("targets", {
port: props.containerPort,
protocol: elbv2.ApplicationProtocol.HTTP,
targets: [service],
healthCheck: {
path: '/health'
}
});
const dnsParams= dnsParameters(this, id)
const magnaHostedZone = route53.HostedZone.fromHostedZoneAttributes(this, 'hostedZone', {
hostedZoneId: dnsParams.hostedZoneId,
zoneName: dnsParams.zoneName
})
// Using alias because load balancer is an AWS resource
new route53.ARecord(this, 'aRecord', {
zone: magnaHostedZone,
target: route53.AddressRecordTarget.fromAlias(new targets.LoadBalancerTarget(loadBalancer)),
recordName: "semantic-search-v2"
});当我运行这个类型记录cdk代码时,它会发生以下错误:
DomainLabelEmpty (Domain label is empty) encountered with 'semantic-search-v2.aws.magna.china.' (Service: AmazonRoute53; Status Code: 400; Error Code: InvalidInput; Request ID: 9f643150-262c-43fc-87ff-800dca172171; Proxy: null)我不知道“DomainLabelEmpty”是什么意思。
顺便说一句,我帐户的所有子网都是私有的,不能访问公共网络。
提前谢谢你帮我!
发布于 2020-11-22 16:43:17
尝试将r53承载的区域名追加到ARecord的recordName属性。
https://stackoverflow.com/questions/64956686
复制相似问题