Search code examples
aws-step-functionsaws-cdk

How to create VPC endpoint for AWS Step Functions using CDK?


As of CDK 1.30, the InterfaceVpcEndpointAwsService construct does not have a member for AWS Step Functions.

I’ve looked into using InterfaceVpcEndpoint to create one, but I can’t figure out what values to use for all of the props.

How can I do this? Or more generally, how does one create an InterfaceVpcEndpointService for an AWS service that doesn’t have full support from CDK yet?


Solution

  • It turns out that for AWS services, you can actually just create a new instance of InterfaceVpcEndpointAwsService because it has a public constructor.

    If you don’t know what the correct service name is, you can follow the steps in the Interface VPC Endpoints docs to create a VPC endpoint in the console. Then, you can view the endpoint properties to find out the correct service name. (This also has the added benefit of ensuring that the AWS service you want actually supports VPC endpoints.)

    In the case of Step Functions, you would create a VPC endpoint service in CDK like this.

    new InterfaceVpcEndpointAwsService('states');