I have an AWS Lambda function that is supposed to call a Step Function via the aws-sdk/client-sfn package. But the function stops and times out at await client.send( command ).
What do I need to consider to make it work?
import { SFNClient, StartExecutionCommand } from "@aws-sdk/client-sfn";
const client = new SFNClient({region: "eu-west-1"});
export const handler = async ( event ) => {
const d = new Date();
const yr = d.getFullYear();
const inputParams = {
"uid": "xxxx-xxxx-xxxx-xxxx",
"httpMethod": "PUT",
"settings": 1,
yr,
"id": 82,
"rd": 1
};
const command = new StartExecutionCommand({
input: JSON.stringify( inputParams ),
name: "test",
stateMachineArn: process.env.stateMachine
});
try {
const res = await client.send( command );
console.log( res );
client.destroy();
} catch (error) {
console.log(JSON.stringify(error));
}
return res;
};
The same happens with any other AWS service I am trying to call from this Lambda function. The IAM role has full access to all releant services:
The Step Function can be executed manually with no errors.


Solved it by allowing the VPC traffic from the Lambda function's security group.