tl;dr Tips on how to connect to AWS Lambda from Apigee.
AWS Lambda can be directly invoked through an API call.
https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html
Follow the solution described in this repo to generate the signature needed to invoke Lambda. This is a lightweight option to generate the authentication headers required to invoke AWS Lambda.
https://github.com/DinoChiesa/
The repo above covers S3 as an example. Use the snippet below for AWS Lambda.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JavaCallout async="false" continueOnError="false" enabled="true" name="JC-AWS-Signature-V4">
<DisplayName>JC-AWS-Signature-V4</DisplayName>
<Properties>
<Property name="debug">true</Property>
<Property name="service">lambda</Property>
<Property name="endpoint">https://lambda.us-east-1.amazonaws.com</Property>
<Property name="region">us-east-1</Property>
<Property name="key">{private.flow.sec.aws.key}</Property>
<Property name="secret">{private.flow.sec.aws.secret}</Property>
<Property name="message-variable-ref">lambdaCallout</Property>
</Properties>
<ClassName>com.google.apigee.edgecallouts.AWSSignatureV4Callout</ClassName>
<ResourceURL>java://edge-callout-aws-signature-v4.jar</ResourceURL>
</JavaCallout>
The AssignMessage policy below sets the headers, payload and URL to talk to AWS Lambda.
<Set>
<Verb>POST</Verb>
<Headers>
<Header name="X-Amz-Invocation-Type">RequestResponse</Header>
</Headers>
<FormParams/>
<Payload contentType="application/json">{"name":"foo", "type":"bar"}</Payload>
<Path>/2015-03-31/functions/arn:aws:lambda:us-east-1:283052633151:function:serverlessrepo-hello-world-helloworld-1LZWPWEQFFFF/invocations</Path>
</Set>
Hi
The edge-callout-aws-signature-v4.jar file is not available in the bundle
I've updated the repo for the AWS V4 signature - it now includes an example for Lambda, and uses the correct JAR name.
HI @dchiesa1
Is there any other methods to call an AWS Lambda function from Apigee?If yes,can you please let us know.
@NishVOIS This is the fairly straightforward method to call AWS Lambda without introducing any additional components.