AWS CloudFormation
User Guide (Version )

AWS::ApiGatewayV2::ApiMapping

The AWS::ApiGatewayV2::ApiMapping resource contains an API mapping. An API mapping relates a path of your custom domain name to a stage of your API. A custom domain name can have multiple API mappings, but the paths can't overlap. A custom domain can map only to APIs of the same protocol type. For more information, see CreateApiMapping in the Amazon API Gateway V2 API Reference.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::ApiGatewayV2::ApiMapping", "Properties" : { "ApiId" : String, "ApiMappingKey" : String, "DomainName" : String, "Stage" : String } }

YAML

Type: AWS::ApiGatewayV2::ApiMapping Properties: ApiId: String ApiMappingKey: String DomainName: String Stage: String

Properties

ApiId

The identifier of the API.

Required: Yes

Type: String

Update requires: Replacement

ApiMappingKey

The API mapping key.

Required: No

Type: String

Update requires: No interruption

DomainName

The domain name.

Required: Yes

Type: String

Update requires: Replacement

Stage

The API stage.

Required: Yes

Type: String

Update requires: No interruption

Return Values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the API mapping resource ID.

For more information about using the Ref function, see Ref.

Examples

API mapping creation example

The following example creates an ApiMapping resource called MyApiMapping.

JSON

{ "MyApiMapping": { "Type": "AWS::ApiGatewayV2::ApiMapping", "Properties": { "DomainName": "mydomainame.us-east-1.com", "ApiId": { "Ref": "MyApi" }, "Stage": { "Ref": "MyStage" } } } }

YAML

MyApiMapping: Type: 'AWS::ApiGatewayV2::ApiMapping' Properties: DomainName: mydomainame.us-east-1.com ApiId: !Ref MyApi Stage: !Ref MyStage

See Also