AWS Lambda Policy | MuleSoft Documentation
# AWS Lambda Policy
**Policy name**  
---  
Triggers an AWS Lambda function from a standard HTTP request  
Transformation  
**First Flex Gateway version available**  
**Returned Status Codes** |  502 - Bad Gateway, requests are blocked due to circuit breaker activation  
## Summary
The AWS Lambda policy triggers an AWS Lambda function from a standard HTTP request. Pass the HTTP request payload as is or wrapped in a JSON schema.
The AWS Lambda policy is an extension of the AWS Lambda filter native to Envoy. To learn more about the AWS Lambda filter, see AWS Lambda Filter. Not all AWS Lambda filter parameters are available to the AWS Lambda policy. To find what parameters are configurable, see Configuring Policy Parameters.
## Configuring Policy Parameters
### Flex Gateway Local Mode
In Local Mode, you apply the policy to your API via declarative configuration files. Refer to the following policy definition and table of parameters:
```
- policyRef:
  name: native-aws-lambda
 config:
   arn: <string> // REQUIRED
   payloadPassthrough: <boolean> // REQUIRED
   invocationMode: <string> // REQUIRED
   authenticationMode: <string> // REQUIRED
   credentialProfile: <string> // OPTIONAL
   credentials:
    accessKeyId: <string> // OPTIONAL
    secretAccessKey: <string> // OPTIONAL
    sessionToken: <string> // OPTIONAL
```

Parameter | Required or Optional | Default Value | Description  
---|---|---|---  
AWS Lambda ARN in this format: `arn:<partition>:lambda:<region>:<account-number>:function:<function-name>`.  
`payloadPassthrough` |  By default, Flex sends the request to the AWS Lambda function wrapped in JSON. When `payloadPassthrough` is enabled, the request is sent as is.  
`invocationMode` |  The way to invoke the Lambda function, either `sync` or `async`. For `sync`, Flex Gateway awaits the AWS response. For `async`, Flex Gateway doesn’t wait for the response from AWS.  
`authenticationMode` |  Determines the mode of authentication. Options are: `default`, uses in order credential AWS environment variables, AWS credential file, AWS roles; `profile`, profile from AWS credential file; `static`, credentials configured in the policy.  
`credentialProfile` |  Specifies the credential `profile`. Only for `profile` authentication mode.  
Configures the `static` credentials object. Only for `static` authentication mode.  
`credentials.accessKeyId` |  AWS access key ID  
`credentials.secretAccessKey` |  AWS access key  
`credentials.sessionToken` |  Session token  
#### Resource Configuration Example
The following example defines a rate limit of three requests every six seconds:
```
- policyRef:
  name: native-aws-lambda
 config:
   arn: rn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account-number&gt;:function:&lt;function-name&gt;
   payloadPassthrough: true
   invocationMode: sync
   authenticationMode: static
   credentials:
    accessKeyId: id
    secretAccessKey: secret
    sessionToken: token
```

### Managed Flex Gateway and Flex Gateway Connected Mode
When you apply the policy to your API instance from the UI, the following parameters are displayed:
Parameter | Required or Optional | Description  
---|---|---  
The ARN of the AWS Lambda |  AWS Lambda ARN in this format: `arn:<partition>:lambda:<region>:<account-number>:function:<function-name>`.  
Payload passthrough |  By default, Flex sends the request to the AWS Lambda function wrapped in JSON. When enabled, the request is sent as is.  
Determines the way to invoke the Lambda function |  The way to invoke the Lambda function. For **Sync** , Flex Gateway awaits the AWS response. For **Async** , Flex Gateway doesn’t wait for the response from AWS.  
Determines origin of credentials |  Determines the mode of authentication. Options are: **Default** , uses in order credential AWS environment variables, AWS credential file, AWS roles; **Profile** , profile from AWS credential file; **Static** , credentials configured in the policy.  
Credentials profile |  Specifies the credential profile. Only for **Profile** authentication mode.  
Credentials |  Configures the static credentials. Only for **Static** authentication mode.  
AccessKeyId |  AWS access key ID  
SecretAccessKey |  AWS access key  
SessionToken |  Session token