Software AG Products 10.5 | Using API Gateway | Usage Scenarios | Custom Policy Extension | How Do I Invoke an AWS Lambda Function using Custom Extension?
 
How Do I Invoke an AWS Lambda Function using Custom Extension?
 
Configuring an AWS Alias
This use case explains how to invoke an AWS Lambda function using custom extension. The custom extension configured can be enforced in any of the policy stages and used during API processing.
The use case starts when you have an API that has to be enforced with a custom extension and ends when you successfully invoke the API with the custom extension enforced.
*To invoke an AWS Lambda function using custom extension
1. Create a Lambda function and ensure it is active.
For details on how to create an AWS Lambda function, see https://docs.aws.amazon.com/lambda/latest/dg/getting-started.html.
2. Configure AWS alias.
For details on how to configure an AWS alias, see Configuring an AWS Alias.
3. Click APIs on the title navigation bar.
4. Click the required API.
The API details page appears.
5. Click Edit.
6. Select Policies.
7. Click Required Policy stage > Custom Extension.
This adds the custom extension policy where you can configure the required properties.
Click to open the policy properties section in a full page.
8. Select AWS Lambda in the custom extension Type field.
9. Provide the following information in the AWS Lambda section, as required:
Property
Description
Function Name
Provide the AWS Lambda function name you want to invoke.
Invocation Type
Specify the AWS invocation type, asynchronous or synchronous.
Available options are:
*RequestResponse (synchronous type)
*Event (asynchronous type)
AWS Alias
Provide the AWS alias configured for the AWS account.
Client Configuration
Provide the following client configuration details and click .
*Name. Start typing the client property name and select the required property from the type-ahead search results displayed.
API Gateway supports the following properties that you can configure: Socket timeout(ms), Connection timeout(ms), Request timeout(ms), Connection expiration timeout(ms), Maximum Coneection idle time(ms), Client execution timeout(ms), Server error retry count, Enable throttle retries, Maximum client retry count, TCP send buffer size hints, TCP receive buffer size hints, Enable gzip requests, Enable Expect-Continue, Enable host prefix injection, Enable Keep-alive, Enable, Response metadata caching, Response metadata cache size, and Signature Algorithm.
*Value. Provide a value for the client property specified.
You can configure multiple properties.
For details about the supported client properties, see the following AWS documents:
10. Configure the custom properties of the custom extension as required.
For details about the custom extension properties and their descriptions, see Custom Extension Properties.
11. Click Save.
The API is saved with the added custom extension.
12. Invoke the API.
The applied custom extension invokes the AWS lambda function and processes as configured.