By using AWS re:Post, you agree to the Terms of Use

Questions tagged with Network Load Balancer

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

CDK - Connect a Network Load Balancer and a Neptune Cluster Endpoint together

For the past two days I've been struggling with exposing a Neptune endpoint to the public using an NLB **in a single stack**. The architecture was inspired by [this document]( For the life of me I haven't been able to figure out how to obtain the IP address of the Neptune endpoint to use as the target of NLB's listener. The main issue resides in the conversion of the Neptune `hostname` to an IP address as required by NLB's target group `IPTarget` and how CDK synthesizes stacks before deployment. I explored the use of CustomResources to no avail due to my limited familiarity with the topic (day 5 of my aws journey), and was hoping someone could point me in the right direction. Here's my stack (CDK app repo [here]( ```js import { Construct } from "constructs"; import { Stack } from "aws-cdk-lib"; import * as ec2 from "aws-cdk-lib/aws-ec2"; import * as elbv2 from "aws-cdk-lib/aws-elasticloadbalancingv2"; import * as neptune from "@aws-cdk/aws-neptune-alpha"; import { Props } from "../../_config"; import createVPC from "../helpers/createVPC"; import createNeptuneCluster from "../helpers/createNeptuneCluster"; import createNLB from "../helpers/createNLB"; export class ABCGraphStack extends Stack { public readonly vpc: ec2.Vpc; public readonly subnets: { public: ec2.ISubnet[]; private: ec2.ISubnet[]; isolated: ec2.ISubnet[]; }; public readonly neptuneCluster: neptune.DatabaseCluster; public readonly neptuneReadEndpoint: neptune.Endpoint; public readonly neptuneWriteEndpoint: neptune.Endpoint; public readonly nlb: elbv2.NetworkLoadBalancer; constructor(scope: Construct, id: string, props: Props) { super(scope, id, props); // Create VPC for use with Neptune const { vpc, subnets } = createVPC(props, this); this.vpc = vpc; this.subnets = subnets; // Create Neptune Cluster this.neptuneCluster = createNeptuneCluster( props, this, this.vpc, this.subnets ); // Update Neptune Security Group to allow-all-in this.neptuneCluster.connections.allowDefaultPortFromAnyIpv4( "Allow All Inbound to Neptune" ); // Add an ordering dependency on VPC. this.neptuneCluster.node.addDependency(this.vpc); // Output the Neptune read/write addresses this.neptuneReadEndpoint = this.neptuneCluster.clusterReadEndpoint; this.neptuneWriteEndpoint = this.neptuneCluster.clusterEndpoint; // HOW TO GET IP ADDRESS OF this.neptuneWriteEndpoint.hostname? // Create Network Load Balancer this.nlb = createNLB(props, this, this.vpc, "????????", 8182); this.nlb.node.addDependency(this.neptuneCluster); } } ```
asked 2 months ago