Lambda example sending task succeeded status back to step function

const AWS = require('aws-sdk');

exports.handler = async (event, context) => {
  // Get the Step Functions client.
  const stepFunctions = new AWS.StepFunctions({
    region: process.env.AWS_REGION,

  // Get the task token.
  const taskToken = event.taskToken;

  // Create the send task success request.
  const sendTaskSuccessRequest = {
    taskToken: taskToken,
    output: JSON.stringify(event.output),

  // Send the task success request.
  await stepFunctions.sendTaskSuccess(sendTaskSuccessRequest);

This code uses the aws-sdk Node.js module to interact with AWS services. The first line imports the module. The next line creates a new Step Functions client. The taskToken variable is set to the task token that was passed to the Lambda function.

The sendTaskSuccessRequest object is created with the taskToken and output properties. The output property is the output of the Lambda function.

The sendTaskSuccess method is then used to send the SendTaskSuccess request to Step Functions.

This is just a simple example of how to send a SendTaskSuccess request to Step Functions from a Lambda function. You can customize the code to fit your specific needs.

Here are some additional things to keep in mind when sending a SendTaskSuccess request to Step Functions:

You need to make sure that the Step Functions client is in the same region as the Lambda function.
You need to have the appropriate permissions to send a SendTaskSuccess request.
You need to handle errors that may occur during the request. For example, the Step Functions client may be unavailable or the request may fail.