The object describing an event source with type HttpApi.
If an OpenApi definition for the specified path and method exists on the API, SAM will add the Lambda integration and security section (if applicable) for you.
If no OpenApi definition for the specified path and method exists on the API, SAM will create this definition for you.
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
[ApiId](#sam-function-httpapi-apiid): String
[Auth](#sam-function-httpapi-auth): HttpApiFunctionAuth
[Method](#sam-function-httpapi-method): String
[Path](#sam-function-httpapi-path): String
[PayloadFormatVersion](#sam-function-httpapi-payloadformatversion): String
[RouteSettings](#sam-function-httpapi-routesettings): [RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)
[TimeoutInMillis](#sam-function-httpapi-timeoutinmillis): Integer
ApiId
Identifier of an AWS::Serverless::HttpApi resource defined in this template.
If not defined, a default AWS::Serverless::HttpApi resource is created called ServerlessHttpApi
using a generated OpenApi document containing a union of all paths and methods defined by Api events defined in this template that do not specify an ApiId
.
This cannot reference an AWS::Serverless::HttpApi resource defined in another template.
Type: String
Required: No
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
Auth
Auth configuration for this specific Api+Path+Method.
Useful for overriding the API's DefaultAuthorizer
or setting auth config on an individual path when no DefaultAuthorizer
is specified.
Type: HttpApiFunctionAuth
Required: No
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
Method
HTTP method for which this function is invoked.
If no Path
and Method
are specified, SAM will create a default API path that routes any request that doesn't map to a different endpoint to this Lambda function. Only one of these default paths can exist per API.
Type: String
Required: No
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
Path
Uri path for which this function is invoked. Must start with /
.
If no Path
and Method
are specified, SAM will create a default API path that routes any request that doesn't map to a different endpoint to this Lambda function. Only one of these default paths can exist per API.
Type: String
Required: No
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
PayloadFormatVersion
Specifies the format of the payload sent to an integration.
NOTE: PayloadFormatVersion requires SAM to modify your OpenAPI definition, so it only works with inline OpenApi defined in the DefinitionBody
property.
Type: String
Required: No
Default: 2.0
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
RouteSettings
The per-route route settings for this HTTP API. For more information about route settings, see AWS::ApiGatewayV2::Stage RouteSettings in the API Gateway Developer Guide.
Note: If RouteSettings are specified in both the HttpApi resource and event source, AWS SAM merges them with the event source properties taking precedence.
Type: RouteSettings
Required: No
AWS CloudFormation compatibility: This property is passed directly to the [RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)
property of an AWS::ApiGatewayV2::Stage
resource.
TimeoutInMillis
Custom timeout between 50 and 29,000 milliseconds.
NOTE: TimeoutInMillis requires SAM to modify your OpenAPI definition, so it only works with inline OpenApi defined in the DefinitionBody
property.
Type: Integer
Required: No
Default: 5000
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
HttpApi Event that uses the default path. All unmapped paths and methods on this API will route to this endpoint.
Events:
HttpApiEvent:
Type: HttpApi
HttpApi Event that uses a specific path and method.
Events:
HttpApiEvent:
Type: HttpApi
Properties:
Path: /
Method: GET
HttpApi Event that uses an Authorizer.
Events:
HttpApiEvent:
Type: HttpApi
Properties:
Path: /authenticated
Method: GET
Auth:
Authorizer: OpenIdAuth
AuthorizationScopes:
- scope1
- scope2