- Newest
- Most votes
- Most comments
Hello,
From the description, I understand that you are using "NetworkLoadBalancer.fromLookup" in CDK and you are getting the responses of below format for the ".loadBalancerDnsName" method on the obtained object.
my-load-balancer-1234567890.us-west-2.elb.amazonaws.com
<LoadBalancerName>-XXXXXX.elb.<Region>.amazonaws.com
I would like to inform you that I was able to replicate the same in my test environment. Kindly note that this behaviour is expected and occurs because on the first "cdk deploy/synth" if the "cdk.context.json" file is empty and/or does not contain the load-balancer details.
For all the subsequent "cdk deploy", the correct value was obtained as the "cdk.context.json" file would be populated with the required details. You can learn more about "cdk context" at doc[1].
Hence, you can perform "cdk deploy/synth" and check the "cdk.context.json" file for the load-balancer details as shown below:
"load-balancer:account=XXXXXX: {
"loadBalancerArn": "arn:aws:elasticloadbalancing:XXXXXX",
"loadBalancerCanonicalHostedZoneId": "XXXXXX",
"loadBalancerDnsName": "<LoadBalancerName>-XXXXXX.elb.<Region>.amazonaws.com",
"vpcId": "vpc-XXXXX",
"securityGroupIds": [],
"ipAddressType": "ipv4"
}
thanks for your response Harsha! I think its not about context, what I am trying to say is the above function is returning 3 NLBs arns as mentioned below arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/network/my-load-balancer/50dc6c495c0c9188 arn:aws:elasticloadbalancing:us-east-2:<dev-account-id>:loadbalancer/net/b72e485999b754299ae2067c2c1b3747/3eb24f395333b0d4 arn:aws:elasticloadbalancing:us-east-2:<dev-account-id>:loadbalancer/net/b72e485999b754299ae2067c2c1b3747/3eb24f395333b0d4
if you see 2nd and 3rd arn are same, not sure why it is so. Also I have checked by printing the contents of cdk.context.json file after cdk synth in our AWS CDK pipeline and it is returning only 1 NLB(arn:aws:elasticloadbalancing:us-east-2:<dev-account-id>:loadbalancer/net/b72e485999b754299ae2067c2c1b3747/3eb24f395333b0d4).
So the point is why above function is returning this nlb: arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/network/my-load-balancer/50dc6c495c0c9188 it is not even there in us-west-2 region.
Relevant content
- asked 4 months ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
Basically vpcLink is creating correctly, but when I am passing the nlbDnsName to the RestAPI then it is failing because it is getting that my-load-balancer DNS name