diff --git a/lib/shared/index.ts b/lib/shared/index.ts index ff420f594..dae2d9fff 100644 --- a/lib/shared/index.ts +++ b/lib/shared/index.ts @@ -108,10 +108,12 @@ export class Shared extends Construct { }); // Create VPC Endpoint for SageMaker Runtime - vpc.addInterfaceEndpoint("SageMakerRuntimeEndpoint", { - service: ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_RUNTIME, - open: true, - }); + if (props.config.llms.sagemaker.length > 0) { + vpc.addInterfaceEndpoint("SageMakerRuntimeEndpoint", { + service: ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_RUNTIME, + open: true, + }); + } if (props.config.privateWebsite) { // Create VPC Endpoint for AppSync @@ -129,10 +131,11 @@ export class Shared extends Construct { service: ec2.InterfaceVpcEndpointAwsService.SNS, }); - // Create VPC Endpoint for Step Functions - vpc.addInterfaceEndpoint("StepFunctionsEndpoint", { - service: ec2.InterfaceVpcEndpointAwsService.STEP_FUNCTIONS, - }); + if (props.config.rag.enabled) { + vpc.addInterfaceEndpoint("StepFunctionsEndpoint", { + service: ec2.InterfaceVpcEndpointAwsService.STEP_FUNCTIONS, + }); + } // Create VPC Endpoint for SSM vpc.addInterfaceEndpoint("SSMEndpoint", {