AWS Lambda Extension

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.
info

Version: 1.1.1

Execute functions deployed on AWS Lambda. Use this extension to list the functions available in your AWS account, then invoke specific functions.

Prerequisites

Before using the extension from an API proxy using the ExtensionCallout policy, you must:

About AWS Lambda

AWS Lambda provides compute environments where you can execute functions in one of the supported languages.

Actions

invoke

Invokes a function on AWS Lambda.

For more detail about parameters, see the AWS Lambda Invoke documentation.

Syntax

<Action>invoke</Action>
<Input><![CDATA[
{
  "functionName" : "function-on-lambda",
  "invocationType" : "RequestResponse | Event | DryRun",
  "logType" : "None | Tail",
  "qualifier" : "Version-or-alias",
  "payload" : "Escaped-JSON-string"
}
]]>
</Input>
<Output>flow-variable</Output>

Example

<Action>invoke</Action>
<Input><![CDATA[
{
  "functionName" : "helloWorld",
  "invocationType" : "RequestResponse",
  "logType" : "None",
  "qualifier" : "$LATEST",
  "payload" : "{ \"key\": \"val\" }"
}
]]>
</Input>
<Output>function.response.value</Output>

Request parameters

For more detail about parameters, see the AWS Lambda Invoke documentation.

Parameter Description Type Default Required
functionName The name of the function to invoke. String. None. Yes.
invocationType Specifies whether to invoke the function synchronously, asynchronously, or validate parameter values. String. None. No.
logType Optionally specifies whether to return the last 4 KB of log data. String None. No.
qualifier The version of alias of a published Lambda function. String None. No.
payload JSON as input to the Lambda function. String None. No.

Response

An array of functions containing specific version details. The following is an example:

{
  "StatusCode" : 200,
  "Payload" : "{\"statusCode\":200,\"body\":\"\\\"Hello World!\\\"\"}"
}

Response properties

Property Description Type Default
StatusCode HTTP status code. Integer None.
Payload JSON representing the object returned by the function. Present only if the invocation type is RequestResponse. For a function error, this contains an error description message. String None.

listFunctions

Lists the available AWS Lambda functions.

For more detail about parameters, see the AWS Lambda ListFunctions documentation.

Syntax

<Action>listFunctions</Action>
<Input><![CDATA[
{
  "masterRegion" : "ALL | [a-z]{2}(-gov)?-[a-z]+-\d{1}",
  "functionVersion" : "ALL",
  "maxItems" : 1 - 10000
}
]]>
</Input>
<Output>flow-variable</Output>

Example

<Action>listFunctions</Action>
<Input><![CDATA[
{
  "masterRegion" : "ALL",
  "functionVersion" : "ALL",
  "maxItems" : 50
}
]]>
</Input>
<Output>function.list</Output>

Request parameters

For more detail about parameters, see the AWS Lambda ListFunctions documentation.

Parameter Description Type Default Required
masterRegion The region (such as us-east-2) whose functions should be listed; ALL to include functions from any region. If specified, you also must specify the functionVersion. String None. No.
functionVersion Specify ALL to list all published versions. If not specified, only the latest unpublished version ARN is returned. String None. No.
maxItems The maximum number of functions to return in response. Must be greater than 0. The absolute maximum that can be returned is 50. Integer None. No.

Response

JSON representing an array of functions containing specific version details.

[
  {
    "FunctionName": "helloWorld",
    "FunctionArn": "arn:aws:lambda:fake-region:012345:function:helloWorld",
    "Runtime": "nodejs",
    "Role": "arn:aws:iam::012345:role/service-role/fakeRole",
    "Handler": "index.handler",
    "Description": "A Hello World lambda function.",
    "Version": "$LATEST"
  },
  {
    "FunctionName": "helloWorld",
    "FunctionArn": "arn:aws:lambda:fake-region:012345:function:helloWorld",
    "Runtime": "nodejs",
    "Role": "arn:aws:iam::012345:role/service-role/fakeRole",
    "Handler": "index.handler",
    "Description": "A Hello World lambda function.",
    "Version": "1"
  }
]

Response properties

Property Description Type Default
Description A description of the function. String. None.
Handler The function that Lambda calls to begin executing the function. String. None.
FunctionArn The function's Amazon Resource Name. String. None.
FunctionName The name of the function. String. None.
Role The function's execution role. String. None.
Runtime The function's runtime environment. String. None.
Version The function's version. String. None.

Configuration Reference

Use the following when you're configuring and deploying this extension for use in API proxies. For steps to configure an extension using the Apigee console, see Adding and configuring an extension.

Common extension properties

The following properties are present for every extension.

Property Description Default Required
name Name you're giving this configuration of the extension. None Yes
packageName Name of the extension package as given by Apigee Edge. None Yes
version Version number for the extension package from which you're configuring an extension. None Yes
configuration Configuration value specific to the extension you're adding. See Properties for this extension package None Yes

Properties for this extension package

Specify values for the following configuration properties specific to this extension.

Property Description Default Required
AWS Lambda Region The name of the region where your functions are deployed. For example: us-east-1. None. Yes.
Credentials When entered in the Apigee Edge console, this is a JSON file containing your Amazon access key ID and access key in the following form:

{
"accessKeyId" : "access-key-ID",
"secretAccessKey" : "secret-access-key"
}

When sent via the management API, it is a base64-encoded value generated from that key JSON file.
None. Yes.