LambdaRequestAuthorizer
Configure a Lambda Authorizer to control access to your API with a Lambda function.
For more information and examples, see Control API access with your Amazon SAM template.
Syntax
To declare this entity in your Amazon Serverless Application Model (Amazon SAM) template, use the following syntax.
YAML
DisableFunctionDefaultPermissions:BooleanFunctionArn:StringFunctionInvokeRole:StringFunctionPayloadType:StringIdentity:LambdaRequestAuthorizationIdentity
Properties
-
Specify
trueto prevent Amazon SAM from automatically creating anAWS::Lambda::Permissionsresource to provision permissions between yourAWS::Serverless::Apiresource and authorizer Lambda function.Default value:
falseType: Boolean
Required: No
Amazon CloudFormation compatibility: This property is unique to Amazon SAM and doesn't have an Amazon CloudFormation equivalent.
-
Specify the function ARN of the Lambda function which provides authorization for the API.
Note
Amazon SAM will automatically create an
AWS::Lambda::Permissionsresource whenFunctionArnis specified forAWS::Serverless::Api. TheAWS::Lambda::Permissionsresource provisions permissions between your API and authorizer Lambda function.Type: String
Required: Yes
Amazon CloudFormation compatibility: This property is unique to Amazon SAM and doesn't have an Amazon CloudFormation equivalent.
-
Adds authorizer credentials to the OpenApi definition of the Lambda authorizer.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is unique to Amazon SAM and doesn't have an Amazon CloudFormation equivalent.
-
This property can be used to define the type of Lambda Authorizer for an API.
Valid values:
TOKENorREQUESTType: String
Required: No
Default:
TOKENAmazon CloudFormation compatibility: This property is unique to Amazon SAM and doesn't have an Amazon CloudFormation equivalent.
-
This property can be used to specify an
IdentitySourcein an incoming request for an authorizer. This property is only required if theFunctionPayloadTypeproperty is set toREQUEST.Type: LambdaRequestAuthorizationIdentity
Required: Conditional
Amazon CloudFormation compatibility: This property is unique to Amazon SAM and doesn't have an Amazon CloudFormation equivalent.
Examples
LambdaRequestAuth
YAML
Authorizers: MyLambdaRequestAuth: FunctionPayloadType: REQUEST FunctionArn: Fn::GetAtt: - MyAuthFunction - Arn FunctionInvokeRole: Fn::GetAtt: - LambdaAuthInvokeRole - Arn Identity: Headers: - Authorization1