Distributed Tracing for AWS CDK Applications

Home Blog Distributed Tracing for AWS CDK Applications
Lumigo AWS CDK Support

What is AWS Cloud Development Kit (AWS CDK) v2? 

The AWS CDK lets users build as Infrastructure as Code (IaC) reliable, scalable, and cost-effective applications in their cloud environments. With the AWS CDK, developers can use various supported programming languages to create constructs (reusable cloud components) and compose them together into stacks and applications. For a more in-depth introduction to the AWS CDK, check out this great post by Lumigo CEO, Erez Berkner. 

https://docs.aws.amazon.com/cdk/v2/guide/home.html

Monitoring AWS CDK Stacks and Apps

Monitoring AWS CDK stacks and apps is a significant challenge. As teams continually build out their serverless and container footprint with the AWS CDK, they often end up managing hundreds or even thousands of individual components: Amazon S3 buckets, Amazon DynamoDB tables, AWS SQS queues, and so on. These complex applications need excellent observability, and above all else, distributed tracing, to identify and troubleshoot performance issues. Without it, effective troubleshooting is difficult and time-consuming and issues can go undetected for a long time.

Configuring distributed tracing manually is toilsome and difficult. Depending on the observability tooling adopted, there can be a significant amount of dependencies and code inside your applications. And, even when you take on this monumental task, you’re often left with gaps in distributed tracing that deprive you of the full context you need to quickly troubleshoot your applications. This lack of insight has direct, very tangible costs in terms of resolution times as developers try to recreate the issue in their dev environments or try to understand the series of the events that lead to the issue by painstakingly reading and understanding logs and timestamps from multiple components.

There is a (Much!) Better Way 

Lumigo has the best distributed tracing for serverless. Full stop. And one single line of code is all it takes to adopt Lumigo’s distributed tracing for CDK-based applications. When you use the Lumigo CDK construct, Lumigo will automatically apply tracing on all AWS Lambda Node.js and Python functions, as well as Amazon ECS workloads running containerized Node.js or Python applications.    

import { Lumigo } from '@lumigo/cdk-constructs-v2';
import { App, SecretValue } from 'aws-cdk-lib';

const app = new App();

// Add here stacks and constructs


// This will trace all Lambda functions and ECS workloads managed with supported constructs. It assumes you have the Lumigo token in the 'LumigoToken'AWS Secret Manager secret; SSM parameters and even plain text works too, see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html
new Lumigo({lumigoToken:SecretValue.secretsManager('LumigoToken')}).traceEverything(app);

app.synth();

The one-line of code above does all the work of setting up distributed tracing with Lumigo, and avoids the toilsome and error-prone, manual process of instrumenting each and every Lambda function or ECS workload of an entire CDK app. And if you want more fine-grained control, tracing single stacks, Lambda functions, ECS services and tasks is also supported, each with just one line of code that effectively says “Lumigo, trace me that!”.

Get Started Today

Lumigo’s best-in-class serverless and container troubleshooting platform is available with one-click, batteries-included, for all Node.js and Python Lambda functions and ECS services and tasks across a CDK app or stack for free. With Lumigo, you can get complete visibility into your serverless and containerized applications, which is crucial for effective troubleshooting and quick resolution times. Say goodbye to the complexities of manually setting up monitoring, find out at the worst possible time you forgot something viral, and enjoy the benefits of Lumigo’s easy and comprehensive monitoring for your AWS CDK apps today.