AWS Api gateway for REST API does not work with multi-level base path mapping

0

I am currently trying to use aws api gateway CLI to create a multi-level base path mapping. I am running the following command:

aws apigateway create-base-path-mapping --domain-name rimbleanalytics.com --base-path orders/v2 --rest-api-id f3ho0c7zx0 --stage production

which gives me an error:

An error occurred (BadRequestException) when calling the CreateBasePathMapping operation: API Gateway V1 doesn't support the slash character (/) in base path mappings. To create a multi-level base path mapping, use API Gateway V2.

This is inconsistent with https://aws.amazon.com/blogs/compute/using-multiple-segments-in-amazon-api-gateway-base-path-mapping/ which states for REST Api's use API Gateway V1. When trying to use API Gateway V2 we get an error stating it can only be used for HTTP apis. How does one create multi-level base path mapping for REST APIs.

1개 답변
1

Both REST and HTTP APIs are supported, but the CLI to create the mapping is in apigatewayv2. You should use the following command:

aws apigatewayv2 create-api-mapping --domain-name rimbleanalytics.com --api-mapping-key orders/v2 --api-id f3ho0c7zx0 --stage production

profile pictureAWS
전문가
Uri
답변함 2년 전
  • Hey Uri - thanks for the response but it does not work:

    aws apigatewayv2 create-api-mapping --domain-name rimbleanalytics.com --api-mapping-key v1/orders --api-id f3ho0c7zx0 --stage production

    An error occurred (BadRequestException) when calling the CreateApiMapping operation: Only REGIONAL domain names can be managed through the API Gateway V2 API. For EDGE domain names, please use the API Gateway V1 API. Also note that only REST APIs can be attached to EDGE domain names.

  • Did not know you are working with Edge optimized APIs. From the documentation: To configure API mappings with multiple levels, your custom domain name must be regional and use the TLS 1.2 security policy.

    This means that you can't achieve what you want as your custom domain name is edge optimized.

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

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

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