DEV Community

Cover image for AWS Serverless: CloudWatch Live Tail for Lambda in VS Code
Girish Bhatia
Girish Bhatia

Posted on

AWS Serverless: CloudWatch Live Tail for Lambda in VS Code

On March 4th, 2025, AWS added support for CloudWatch log live tail for Lambda in VS Code.

Keep in consideration that CloudWatch live tail is not a new feature, however, tailing this log in VS Code for a selected Lambda function is the new feature added!

In this article, I will demonstrate the steps required to configure and use the CloudWatch live tail feature in VS Code.

Let's look at the diagram!

Image arch

Introduction to Live Tail for Lambda in VS Code

On March 4, 2025, AWS announced support for Live Tail for Lambda in VS Code. This feature allows developers to monitor function execution in real time. Since an IDE is where the code resides, having the ability to view logs without leaving the IDE is a productivity-enhancing capability. This feature improves debugging support and enhances overall development efficiency.

Install AWS Toolkit for VS Code

AWS tool kit is a VS Code extension. This tool kit supports many features like connecting with AWS account and services like S3, Lambda and others. I will first configure this toolkit.

To configure AWS tool kit:

  • Start VS Code IDE
  • Navigate to the Extension Marketplace
  • Look for AWS Toolkit and install it
  • Once this extension is installed configure the extension by adding AWS credential

Image awstoolkit

Connect VS Code to AWS

If this is your first time setting up the AWS Toolkit, you need to select a profile to connect to your AWS account.

  • Click on the AWS icon and select Connect to AWS.
  • Choose your AWS profile.
  • Ensure the correct AWS Region is selected for your Lambda function.

Image connect

Enable Live Log Tail

Let's enable Live Log Tail.

  • In VS Code, navigate to the AWS Explorer.
  • Locate your AWS Lambda function.
  • Right-click the function and select Tail logs.
  • Provide a pattern to filter the logs or press Enter to tail all logs.
  • This will start streaming logs directly from Amazon CloudWatch into VS Code.

Validate Live Log Tail

Now that we have connectivity and Live Tail streaming enabled, let's validate it by invoking a Lambda function that will publish logs to CloudWatch Logs.

aws lambda invoke --function-name helloworldgb --region us-east-2

Image func

Observe the logs in Live Tail and check for logging, errors, and other relevant details to confirm that the function is working as expected.

Image error

I will provide a JSON payload so that function invocation is successful.

Image success

Conclusion

In this article, I demonstrated how to configure CloudWatch Live Tail Logs for an AWS Lambda function in VS Code.

AWS Lambda's Live Log Tail in VS Code provides an efficient way to monitor and debug Lambda functions in real time, directly from the VS Code IDE. Try setting up Live Log Tail today and experience real-time insights right in VS Code!

I hope you found this article both helpful and informative!

Thank you for reading!

Watch the video here:


https://www.youtube.com/watch?v=Wc1zkn5NnpU

π’’π’Ύπ“‡π’Ύπ“ˆπ’½ ℬ𝒽𝒢𝓉𝒾𝒢
𝘈𝘞𝘚 𝘊𝘦𝘳𝘡π˜ͺ𝘧π˜ͺ𝘦π˜₯ 𝘚𝘰𝘭𝘢𝘡π˜ͺ𝘰𝘯 𝘈𝘳𝘀𝘩π˜ͺ𝘡𝘦𝘀𝘡 & π˜‹π˜¦π˜·π˜¦π˜­π˜°π˜±π˜¦π˜³ 𝘈𝘴𝘴𝘰𝘀π˜ͺ𝘒𝘡𝘦
𝘊𝘭𝘰𝘢π˜₯ π˜›π˜¦π˜€π˜©π˜―π˜°π˜­π˜°π˜¨π˜Ί 𝘌𝘯𝘡𝘩𝘢𝘴π˜ͺ𝘒𝘴𝘡

Top comments (0)