AWS Api gateway for REST API does not work with multi-level base path mapping
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.
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
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.
Relevant questions
BasePathMapping
Accepted Answerasked 3 years agoDelete base path mapping in API Gateway doesn't work
asked 5 years agoAPI Gateway API Mappings deployed through CDK do not work until modified via console
asked a month agoI'm getting {"message":"Forbidden"} when trying to access my lambda from custom domain in api Gateway
asked 5 months agoHow to create Signature V4 authentication header when uploading files as multipart/form-data in REST API of API Gateway?
asked 3 months agoAPI Gateway Response Models are Not Exported in Open API Documentation
asked 5 months agoCan I use API Gateway cache invalidation with a custom authorizer ?
asked 4 months agobest way to secure public api-gateway?
asked 2 years agoAWS Api gateway for REST API does not work with multi-level base path mapping
asked 2 months agoAPI Gateway Mapping Template missing toJson
asked 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.