I'm trying to create an Interface VPC Endpoint for an existing VPC using AWS CDK. According to the InterfaceVpcEndpointOptions, specifying subnets is optional. By default, the endpoint network interface is created in private subnets, with at most one per availability zone.
Below is the code I'm working with:
const vpce = vpc.addInterfaceEndpoint('interface-endpoint', {
service: InterfaceVpcEndpointAwsService.S3,
securityGroups: [securityGroup],
privateDnsEnabled: false,
// subnets: // How can I specify subnets here with designated IP addresses?
});
Tags.of(vpce).add('vpceName', vpceName);
I’ve also attached an image showing the UI option where we can select subnets with designated IP addresses for the VPC endpoint:
Can someone please guide me on how to specify subnets with designated IP addresses in the subnets field while creating the interface endpoint?
Any assistance would be greatly appreciated.
This is not available in CloudFormation, and in AWS CDK as a result.
Excerpt from the blog post announcing the feature:
User defined IP on VPC endpoints is available in all commercial AWS Regions and the AWS GovCloud (US) Regions and can be accessed from the VPC Console, CLI and SDK.
This still appears to be the case - according to the CloudFormation documentation, you can only specify subnet IDs, and not custom IPs.
In contrast, the CLI command create-vpc-endpoint
supports a --subnet-configurations
option that allows you to specify custom IP addresses for you endpoint.
I've opened a coverage request in the CloudFormation coverage roadmap GitHub repository, which you will be able to use to track further progress. Disclaimer: I am not an AWS employee, so cannot guarantee anything about it being implemented.