1. Packages
  2. AWS
  3. API Docs
  4. apigateway
  5. BasePathMapping
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.apigateway.BasePathMapping

Explore with Pulumi AI

Connects a custom domain name registered via aws.apigateway.DomainName with a deployed API so that its methods can be called via the custom domain name.

Create BasePathMapping Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new BasePathMapping(name: string, args: BasePathMappingArgs, opts?: CustomResourceOptions);
@overload
def BasePathMapping(resource_name: str,
                    args: BasePathMappingArgs,
                    opts: Optional[ResourceOptions] = None)

@overload
def BasePathMapping(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    domain_name: Optional[str] = None,
                    rest_api: Optional[str] = None,
                    base_path: Optional[str] = None,
                    domain_name_id: Optional[str] = None,
                    stage_name: Optional[str] = None)
func NewBasePathMapping(ctx *Context, name string, args BasePathMappingArgs, opts ...ResourceOption) (*BasePathMapping, error)
public BasePathMapping(string name, BasePathMappingArgs args, CustomResourceOptions? opts = null)
public BasePathMapping(String name, BasePathMappingArgs args)
public BasePathMapping(String name, BasePathMappingArgs args, CustomResourceOptions options)
type: aws:apigateway:BasePathMapping
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. BasePathMappingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. BasePathMappingArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. BasePathMappingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. BasePathMappingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. BasePathMappingArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var basePathMappingResource = new Aws.ApiGateway.BasePathMapping("basePathMappingResource", new()
{
    DomainName = "string",
    RestApi = "string",
    BasePath = "string",
    DomainNameId = "string",
    StageName = "string",
});
Copy
example, err := apigateway.NewBasePathMapping(ctx, "basePathMappingResource", &apigateway.BasePathMappingArgs{
	DomainName:   pulumi.String("string"),
	RestApi:      pulumi.Any("string"),
	BasePath:     pulumi.String("string"),
	DomainNameId: pulumi.String("string"),
	StageName:    pulumi.String("string"),
})
Copy
var basePathMappingResource = new BasePathMapping("basePathMappingResource", BasePathMappingArgs.builder()
    .domainName("string")
    .restApi("string")
    .basePath("string")
    .domainNameId("string")
    .stageName("string")
    .build());
Copy
base_path_mapping_resource = aws.apigateway.BasePathMapping("basePathMappingResource",
    domain_name="string",
    rest_api="string",
    base_path="string",
    domain_name_id="string",
    stage_name="string")
Copy
const basePathMappingResource = new aws.apigateway.BasePathMapping("basePathMappingResource", {
    domainName: "string",
    restApi: "string",
    basePath: "string",
    domainNameId: "string",
    stageName: "string",
});
Copy
type: aws:apigateway:BasePathMapping
properties:
    basePath: string
    domainName: string
    domainNameId: string
    restApi: string
    stageName: string
Copy

BasePathMapping Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The BasePathMapping resource accepts the following input properties:

DomainName
This property is required.
Changes to this property will trigger replacement.
string
Already-registered domain name to connect the API to.
RestApi This property is required. string | string
ID of the API to connect.
BasePath string
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
DomainNameId string
The identifier for the domain name resource. Supported only for private custom domain names.
StageName string
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
DomainName
This property is required.
Changes to this property will trigger replacement.
string
Already-registered domain name to connect the API to.
RestApi This property is required. string | string
ID of the API to connect.
BasePath string
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
DomainNameId string
The identifier for the domain name resource. Supported only for private custom domain names.
StageName string
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
domainName
This property is required.
Changes to this property will trigger replacement.
String
Already-registered domain name to connect the API to.
restApi This property is required. String | String
ID of the API to connect.
basePath String
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
domainNameId String
The identifier for the domain name resource. Supported only for private custom domain names.
stageName String
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
domainName
This property is required.
Changes to this property will trigger replacement.
string
Already-registered domain name to connect the API to.
restApi This property is required. string | RestApi
ID of the API to connect.
basePath string
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
domainNameId string
The identifier for the domain name resource. Supported only for private custom domain names.
stageName string
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
domain_name
This property is required.
Changes to this property will trigger replacement.
str
Already-registered domain name to connect the API to.
rest_api This property is required. str | str
ID of the API to connect.
base_path str
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
domain_name_id str
The identifier for the domain name resource. Supported only for private custom domain names.
stage_name str
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
domainName
This property is required.
Changes to this property will trigger replacement.
String
Already-registered domain name to connect the API to.
restApi This property is required. String |
ID of the API to connect.
basePath String
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
domainNameId String
The identifier for the domain name resource. Supported only for private custom domain names.
stageName String
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.

Outputs

All input properties are implicitly available as output properties. Additionally, the BasePathMapping resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing BasePathMapping Resource

Get an existing BasePathMapping resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: BasePathMappingState, opts?: CustomResourceOptions): BasePathMapping
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        base_path: Optional[str] = None,
        domain_name: Optional[str] = None,
        domain_name_id: Optional[str] = None,
        rest_api: Optional[str] = None,
        stage_name: Optional[str] = None) -> BasePathMapping
func GetBasePathMapping(ctx *Context, name string, id IDInput, state *BasePathMappingState, opts ...ResourceOption) (*BasePathMapping, error)
public static BasePathMapping Get(string name, Input<string> id, BasePathMappingState? state, CustomResourceOptions? opts = null)
public static BasePathMapping get(String name, Output<String> id, BasePathMappingState state, CustomResourceOptions options)
resources:  _:    type: aws:apigateway:BasePathMapping    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
BasePath string
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
DomainName Changes to this property will trigger replacement. string
Already-registered domain name to connect the API to.
DomainNameId string
The identifier for the domain name resource. Supported only for private custom domain names.
RestApi string | string
ID of the API to connect.
StageName string
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
BasePath string
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
DomainName Changes to this property will trigger replacement. string
Already-registered domain name to connect the API to.
DomainNameId string
The identifier for the domain name resource. Supported only for private custom domain names.
RestApi string | string
ID of the API to connect.
StageName string
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
basePath String
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
domainName Changes to this property will trigger replacement. String
Already-registered domain name to connect the API to.
domainNameId String
The identifier for the domain name resource. Supported only for private custom domain names.
restApi String | String
ID of the API to connect.
stageName String
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
basePath string
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
domainName Changes to this property will trigger replacement. string
Already-registered domain name to connect the API to.
domainNameId string
The identifier for the domain name resource. Supported only for private custom domain names.
restApi string | RestApi
ID of the API to connect.
stageName string
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
base_path str
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
domain_name Changes to this property will trigger replacement. str
Already-registered domain name to connect the API to.
domain_name_id str
The identifier for the domain name resource. Supported only for private custom domain names.
rest_api str | str
ID of the API to connect.
stage_name str
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.
basePath String
Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain.
domainName Changes to this property will trigger replacement. String
Already-registered domain name to connect the API to.
domainNameId String
The identifier for the domain name resource. Supported only for private custom domain names.
restApi String |
ID of the API to connect.
stageName String
Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path.

Import

For a non-root base_path:

For a non-root base_path and a private custom domain name:

Using pulumi import, import aws_api_gateway_base_path_mapping using the domain name and base path or domain name, base path and domain name ID (for private custom domain names). For example:

For an empty base_path or, in other words, a root path (/):

$ pulumi import aws:apigateway/basePathMapping:BasePathMapping example example.com/
Copy

For a non-root base_path:

$ pulumi import aws:apigateway/basePathMapping:BasePathMapping example example.com/base-path
Copy

For a non-root base_path and a private custom domain name:

$ pulumi import aws:apigateway/basePathMapping:BasePathMapping example api.internal.example.com/base-path/abcde12345
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.