Skip to main content

api_mappings

Creates, updates, deletes or gets an api_mapping resource or lists api_mappings in a region

Overview

Nameapi_mappings
TypeResource
DescriptionThe 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](https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/domainnames-domainname-apimappings.html#CreateApiMapping) in the *Amazon API Gateway V2 API Reference*.
Idaws.apigatewayv2.api_mappings

Fields

NameDatatypeDescription
api_mapping_idstring
domain_namestringThe domain name.
stagestringThe API stage.
api_mapping_keystringThe API mapping key.
api_idstringThe identifier of the API.
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTDomainName, Stage, ApiId, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all api_mappings in a region.

SELECT
region,
api_mapping_id,
domain_name,
stage,
api_mapping_key,
api_id
FROM aws.apigatewayv2.api_mappings
WHERE region = 'us-east-1';

Gets all properties from an individual api_mapping.

SELECT
region,
api_mapping_id,
domain_name,
stage,
api_mapping_key,
api_id
FROM aws.apigatewayv2.api_mappings
WHERE region = 'us-east-1' AND data__Identifier = '<ApiMappingId>|<DomainName>';

INSERT example

Use the following StackQL query and manifest file to create a new api_mapping resource, using stack-deploy.

/*+ create */
INSERT INTO aws.apigatewayv2.api_mappings (
DomainName,
Stage,
ApiId,
region
)
SELECT
'{{ DomainName }}',
'{{ Stage }}',
'{{ ApiId }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.apigatewayv2.api_mappings
WHERE data__Identifier = '<ApiMappingId|DomainName>'
AND region = 'us-east-1';

Permissions

To operate on the api_mappings resource, the following permissions are required:

Create

apigateway:POST

Update

apigateway:PATCH,
apigateway:GET,
apigateway:PUT

Read

apigateway:GET

Delete

apigateway:DELETE

List

apigateway:GET