By using AWS re:Post, you agree to the Terms of Use
/AWS Api gateway for REST API does not work with multi-level base path mapping/

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 Answers
0

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

EXPERT
answered 2 months ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions