
Answer-first summary for fast verification
Answer: By running cdk synth to synthesize the CDK app, and sam local invoke with the function identifier and path to the CloudFormation template.
The correct answer is C. To test a specific Lambda function locally when using the AWS Cloud Development Kit (AWS CDK), the developer can use the AWS Serverless Application Model (AWS SAM) CLI's local testing capabilities. The process involves running cdk synth to synthesize the CDK application into a CloudFormation template, followed by using sam local invoke with the function's logical identifier and the path to the synthesized CloudFormation template. This sequence allows the developer to test the Lambda function locally.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How can a developer test a specific AWS Lambda function locally in an AWS CDK serverless application setup with AWS SAM and AWS CDK on their workstation?
A
Using sam package and sam deploy, then creating and testing a Lambda test event from the AWS Management Console.
B
Executing cdk synth and cdk deploy, then creating and testing a Lambda test event from the AWS Management Console.
C
By running cdk synth to synthesize the CDK app, and sam local invoke with the function identifier and path to the CloudFormation template.
D
The correct answer is not provided in the question.
No comments yet.