Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.AWS variables for OpenAPI import
You can use the following AWS variables in OpenAPI definitions. API Gateway resolves the variables when the API is imported. To specify a variable,
use ${variable-name}. The following table describes the available AWS variables.
| Variable name |
Description |
AWS::AccountId |
The AWS account ID that imports the API. For example, 123456789012. |
AWS::Partition |
The AWS partition in which the API is imported. For standard AWS Regions, the partition is aws. |
AWS::Region |
The AWS Region in which the API is imported. For example, eusc-de-east-1. |
AWS variables example
The following example uses AWS variables to specify an AWS Lambda function for an integration.
- OpenAPI 3.0
-
openapi: "3.0.1"
info:
title: "tasks-api"
version: "v1.0"
paths:
/:
get:
summary: List tasks
description: Returns a list of tasks
responses:
200:
description: "OK"
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Task"
500:
description: "Internal Server Error"
content: {}
x-amazon-apigateway-integration:
uri:
arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:LambdaFunctionName/invocations
responses:
default:
statusCode: "200"
passthroughBehavior: "when_no_match"
httpMethod: "POST"
contentHandling: "CONVERT_TO_TEXT"
type: "aws_proxy"
components:
schemas:
Task:
type: object
properties:
id:
type: integer
name:
type: string
description:
type: string