File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ export class VpcResourcesStack extends Stack {
108108 this . addInterfaceEndpoint ( "CloudWatchEventsEndpoint" , InterfaceVpcEndpointAwsService . EVENTBRIDGE )
109109 this . addInterfaceEndpoint ( "SSMEndpoint" , InterfaceVpcEndpointAwsService . SSM )
110110 this . addInterfaceEndpoint ( "LambdaEndpoint" , InterfaceVpcEndpointAwsService . LAMBDA )
111- this . addInterfaceEndpoint ( "apiGatewayEndpoint" , InterfaceVpcEndpointAwsService . APIGATEWAY )
111+ this . addPrivateInterfaceEndpoint ( "apiGatewayEndpoint" , InterfaceVpcEndpointAwsService . APIGATEWAY )
112112 this . addGatewayEndpoint ( "S3Endpoint" , InterfaceVpcEndpointAwsService . S3 )
113113
114114 //Outputs
@@ -162,6 +162,16 @@ export class VpcResourcesStack extends Stack {
162162 endpoint . connections . allowFrom ( Peer . ipv4 ( this . vpc . vpcCidrBlock ) , endpoint . connections . defaultPort ! )
163163 }
164164
165+ private addPrivateInterfaceEndpoint ( name : string , awsService : InterfaceVpcEndpointAwsService ) : void {
166+ const endpoint : InterfaceVpcEndpoint = this . vpc . addInterfaceEndpoint ( name , {
167+ service : awsService
168+ } )
169+ this . addEndpointTag ( name , endpoint )
170+
171+ endpoint . connections . allowFrom ( Peer . ipv4 ( this . vpc . privateSubnets [ 0 ] . ipv4CidrBlock ) ,
172+ endpoint . connections . defaultPort ! )
173+ }
174+
165175 private addGatewayEndpoint ( name : string , awsService : InterfaceVpcEndpointAwsService ) : void {
166176 const endpoint : GatewayVpcEndpoint = this . vpc . addGatewayEndpoint ( name , {
167177 service : awsService
You can’t perform that action at this time.
0 commit comments