Skip to main content

AWS Lambda

Manage your AWS Lambda's: invoke them, create new ones, update, delete, and much more...

Credential configuration

To fill the form params you need the Access key id and the Secret access key of the Programatic access user you want to use. This user needs the permissions to have access to Lambda to work properly. If you need to create the user, you can see how to do it here.

In the extra options field you can pass any of the params you can find here.

Here you have an example of a filled credential configuration form in YepCode:

AWS Lambda snippets available in YepCode editor

note

The title is the triggering text for YepCode to autocomplete the script

Integration

New integration from credential
const awsLambdaClient = yepcode.integration.awsLambda("credential-slug");
New integration from plain authentication data
const { LambdaClient } = require("@aws-sdk/client-lambda");

const awsLambdaClient = new LambdaClient({
credentials: {
accessKeyId: "accessKeyId",
secretAccessKey: "secretAccessKey",
},
});

List functions

List functions
const { ListFunctionsCommand } = require('@aws-sdk/client-lambda')
const listFunctionsCommand = new ListFunctionsCommand({});

const { Functions } = await awsLambdaClient.send(listFunctionsCommand);
for(const func of Functions) {
console.log(func.FunctionName, func.Description)
}

Invoke function

Invoke function
const { InvokeCommand, LogType } = require('@aws-sdk/client-lambda')

try {
const params = {
FunctionName: 'funcName',
Payload: JSON.stringify({ foo: 'bar' }),
LogType: LogType.Tail
}
const invokeCommand = new InvokeCommand(params)
const { Payload, LogResult } = await awsLambdaClient.send(invokeCommand)
const result = Buffer.from(Payload).toString()
const logs = Buffer.from(LogResult, 'base64').toString()

console.log(result)
console.log(logs)
} catch (error) {
throw error
} finally {
// if you are using a custom http handler, you may call destroy() to close open connections.
client.destroy()
}

Get function

Put item
const { GetFunctionCommand } = require("@aws-sdk/client-lambda");
const getFunctionCommand = new GetFunctionCommand({ FunctionName: 'funcName' });
const response = await awsLambdaClient.send(getFunctionCommand)
console.log(response);