This is a CDK construct that retrieves the private IP address of an Interface VPC Endpoint:
npm install cdk-vpc-endpoint-with-private-ip
You can create an interface VPC endpoint and retrive its private IP addresses using the VpcEndpointWithPrivateIp
construct.
The ec2.InterfaceVpcEndpointProps
can be passed to the construct to configure the interface VPC endpoint.
import { InterfaceVpcEndpointWithPrivateIp } from 'cdk-vpc-endpoint-with-private-ip';import * as ec2 from 'aws-cdk-lib/aws-ec2';declare const vpc: ec2.IVpc;const endpoint = new InterfaceVpcEndpointWithPrivateIp(this, 'Endpoint', {vpc,service: ec2.InterfaceVpcEndpointAwsService.S3,});const privateIps = endpoint.privateIps;
Note: privateIps
is an array of CDK Tokens, and the actual IP addresses are not determined until the stack is deployed.
I am greatly referencing the content of this post .
Use the snippets below in your Git repositories or elsewhere to add a button that links to this package. The button will automatically update to light mode or dark mode based on whether the user's client has requested a light or dark theme.
[](https://constructs.dev/packages/cdk-vpc-endpoint-with-private-ip)
<a href="https://constructs.dev/packages/cdk-vpc-endpoint-with-private-ip"><img src="https://constructs.dev/badge?package=cdk-vpc-endpoint-with-private-ip" alt="View on Construct Hub"/></a>