How can the developer test a specific Lambda function locally?
Run the sam package and sam deploy commands. Create a Lambda test event from the AWS Management Console. Test the Lambda function.
Run the cdk synth and cdk deploy commands. Create a Lambda test event from the AWS Management Console. Test the Lambda function.
Run the cdk synth and sam local invoke commands with the function construct identifier and the path to the synthesized CloudFormation template.
Run the cdk synth and sam local start-lambda commands with the function construct identifier and the path to the synthesized CloudFormation template.
Explanations:
This option describes deploying the function to the cloud and testing it from the AWS Management Console, not locally.
This option also involves deploying the function to AWS, which is not a local test.
This option usescdk synthto generate the CloudFormation template, thensam local invoketo test the Lambda function locally with the synthesized template.
sam local start-lambdais used to start a local Lambda API endpoint, which is helpful for testing multiple invocations, not a specific single Lambda invocation directly.