AWS CDK apigatewayv2 doesn't include "HttpApi" as docs claim

0

I want to create an API Gateway. I noticed there are 2 versions. and seems like aws is migrating towards the HTTP rather than the REST option. So i decided to go with that. I'm following the python docs: https://docs.aws.amazon.com/cdk/api/v1/python/aws_cdk.aws_apigatewayv2/HttpApi.html

I imported: import aws_cdk.aws_apigatewayv2 as _apigw but api = _apigw.HttpApi(...): "HttpApi" class doesn't even exist.

Someone should urgently handle the mess going on between the v1, v2, and integration/alpha/whatever. Didn't find a way to flag this anywhere.

my requirements.txt file:

aws-cdk-lib==2.63.0
constructs>=10.0.0,<11.0.0
1 個回答
1

The Construct Library for the HTTP API is currently in experimental status.
https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_apigatewayv2_alpha/README.html

Experimental modules need to be installed one by one in CDK v2.
So try adding aws-cdk.aws-apigatewayv2-alpha to requirements.txt

Please refer to this blog as well.
https://aws.amazon.com/jp/blogs/developer/experimental-construct-libraries-are-now-available-in-aws-cdk-v2/

HTTP APIs are designed with minimal features so that they can be offered at a lower price.
Therefore, there are some functional differences from the REST API.
It would be best to choose the HTTP API when you don't need the functions included in the REST API.
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html

profile picture
hayao-k
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南