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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠