Error: 'loadBalancerCanonicalHostedZoneId' was not provided when constructing Network Load Balancer MyLoadBalancerStack/my--test-nlb from attributes.

0

Hi, I need to create one ARecord with network load balancer but I am getting this issue -- Error: 'loadBalancerCanonicalHostedZoneId' was not provided when constructing Network Load Balancer MyLoadBalancerStack/my--test-nlb from attributes

I have used the following code --

............... const ssmParameters = mySSMParameters(); const nlb = NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, my--test-nlb, { loadBalancerArn: ssmParameters.nlbArn });

new ARecord(this, my-api-ARecord, { zone: hostedZone, recordName: recordName, target: RecordTarget.fromAlias(new LoadBalancerTarget(nlb)) });

Please help with your valuable suggestions. Thank you!

1 Resposta
0

Here's a more complete example of how to import a network load balancer:

const nlb = NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, 'my-test-nlb', {
  loadBalancerArn: ssmParameters.nlbArn,
  loadBalancerCanonicalHostedZoneId: 'YourHostedZoneID'
});

Then you can proceed to create your ARecord as you have in your code.

For examples you can check this link out https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.NetworkLoadBalancer.html

respondido há 5 meses
profile picture
ESPECIALISTA
avaliado há 5 meses
profile picture
ESPECIALISTA
Kallu
avaliado há 5 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas