Hands-On Mini Lab
Lambda Invocation and Logs Lab
Usually Free Tier or negligible for a tiny function. Delete the function and log group.
Goal
Reinforce Execution roles, Invocation, CloudWatch Logs, Timeouts, Handler behavior through a small, inspectable activity.
Concepts Reinforced
- Execution roles
- Invocation
- CloudWatch Logs
- Timeouts
- Handler behavior
Prerequisites
- An existing Lambda execution role with AWSLambdaBasicExecutionRole
- AWS CLI and zip utility
Estimated Cost
Exact Steps
- Create a small handler that logs the incoming event and returns a JSON response.
- Package the handler into a zip file.
- Create a Lambda function with the execution role ARN.
- Invoke the function with a sample event.
- Read CloudWatch Logs for the request id.
exports.handler = async (event) => {
console.log(JSON.stringify({ event }));
return { statusCode: 200, body: JSON.stringify({ ok: true }) };
};Verification
- The invocation response contains StatusCode 200.
- The log stream contains the test event and request id.
Cleanup Steps
- Delete the Lambda function.
- Delete the related CloudWatch log group if it is no longer needed.
Sources and Review Metadata
This independent training application is not affiliated with or endorsed by Amazon Web Services. AWS, Amazon Web Services, and AWS certification names are trademarks of Amazon.com, Inc. or its affiliates.