AWS Lambda
Manage your AWS Lambda's: invoke them, create new ones, update, delete, and much more...
Official Websitehttps://aws.amazon.com/lambda/
Tagsawsserverlessfunction
- JavaScript
- Python
NodeJS packagehttps://www.npmjs.com/package/@aws-sdk/client-lambda
Version3.316.0
Credential configuration
To configure this credential, you need the Access Key ID
and the Secret Access Key
of the Programatic access
user you want to use. Make sure this user has the required permissions
to access Lambda to work properly. If you need to create the user,
follow the instructions provided here.
In the extra options field, you can include any of the parameters found here.
Here is 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.
- JavaScript
- Python
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
Get function
const { GetFunctionCommand } = require("@aws-sdk/client-lambda");
const getFunctionCommand = new GetFunctionCommand({ FunctionName: 'funcName' });
const response = await awsLambdaClient.send(getFunctionCommand)
console.log(response);
Integration
New integration from credential
aws_lambda_client = yepcode.integration.aws_lambda("credential-slug")
New integration from plain authentication data
import boto3
session = boto3.Session(
aws_access_key_id="accessKeyId",
aws_secret_access_key="secretAccessKey",
region_name="region"
)
aws_lambda_client = session.client("lambda")
List Functions
List functions
response = aws_lambda_client.list_functions()
for function in response['Functions']:
print(function)
Invoke Function
Invoke function
import json
payload = {
"foo": "bar"
}
response = aws_lambda_client.invoke(
FunctionName='funcName',
Payload=json.dumps(payload),
)
print(response['Payload'].read().decode('utf-8'))
Get Function
Get function
response = aws_lambda_client.get_function(
FunctionName='funcName',
)
print(response)