Can I create a private endpoint in API Gateway while using HTTP API V2? #37139
Replies: 1 comment
-
|
HTTP API (V2) does support private integrations via VPC Links, but it works differently from REST API private endpoints. REST API (V1): You can create a truly private API using a VPC endpoint ( HTTP API (V2): There is no So if your goal is:
In CDK, a VPC Link for HTTP API V2 looks like: import { HttpApi, VpcLink } from "aws-cdk-lib/aws-apigatewayv2";
import { HttpAlbIntegration } from "aws-cdk-lib/aws-apigatewayv2-integrations";
const vpcLink = new VpcLink(this, "VpcLink", {
vpc,
subnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
});
const httpApi = new HttpApi(this, "HttpApi");
httpApi.addRoutes({
path: "/api",
integration: new HttpAlbIntegration("AlbIntegration", listener, {
vpcLink,
}),
});For JWT authorizers (your original use case), HTTP API V2 is the right choice since REST API doesn't natively support JWT authorizers. You can combine the JWT authorizer with the VPC Link integration above. References: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently I have a logging validation with tokens and wanted to introduce JWT Authorizers in API Gateway. However, this seems to require HTTP API V2. I was consider to migrate from REST V1 to it, but it seems V2 does not directly support a private endpoint and would require some workaround. Is this true? If so, is there any plan to have this?
Beta Was this translation helpful? Give feedback.
All reactions