AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

BasePathMapping

This resource creates a base path that clients who call your API must use in the invocation URL. Unless you're importing a domain with `DomainName.fromDomainNameAttributes()`, you can use `DomainName.addBasePathMapping()` to define mappings.

Import

import { BasePathMapping } from 'aws-cdk-lib/aws-apigateway';

Or use the module namespace:

import * as apigateway from 'aws-cdk-lib/aws-apigateway';
// apigateway.BasePathMapping

Properties

Configuration passed to the constructor as BasePathMappingProps.

domainNameRequired
IDomainNameRef

The DomainName to associate with this base path mapping.

restApiRequired
IRestApiRef

The RestApi resource to target.

3 properties inherited from BasePathMappingOptions
attachToStageOptionalinherited from BasePathMappingOptions
boolean

Whether to attach the base path mapping to a stage. Use this property to create a base path mapping without attaching it to the Rest API default stage. This property is ignored if `stage` is provided.

Default: - true

basePathOptionalinherited from BasePathMappingOptions
string

The base path name that callers of the API must provide in the URL after the domain name (e.g. `example.com/base-path`). If you specify this property, it can't be an empty string.

Default: - map requests from the domain root (e.g. `example.com`). If this is undefined, no additional mappings will be allowed on this domain name.

stageOptionalinherited from BasePathMappingOptions
Stage

The Deployment stage of API [disable-awslint:ref-via-interface].

Default: - map to deploymentStage of restApi otherwise stage needs to pass in URL

Get the Amazon API Gateway Cheat Sheet

Everything you need to know about Amazon API Gateway on one page. HD quality, print-friendly.

Download Free Infographic