Skip to content

lumigo-io/aws-cdk-demo-taimos

Repository files navigation

AWS CDK Crash Course: Building and monitoring AWS CDK apps

This repository contains a demo application that demonstrates how to develop and deploy non-trivial cloud applications on AWS using AWS Lambda, Amazon ECS, the AWS Cloud Development Kit (CDK) 2 and other AWS services.

The focus of this demo is on observability, and we will be using Lumigoas our observability tool of choice. By adopting the Lumigo CDK Constructs, with just one line of code in our CDK application, we get our Cloud applications monitored seamlessly with Lumigo.

The application in this repository has been coded live in this Webinar, accompanied by much commentary on Infrastructure as Code, tips and tricks to make awesome containerized applications, design of CDK constructs and more!

Prerequisites

Before you can use this demo project, ensure that you have the following installed:

  • Node.js version 16 or later. (We like a lot nvm to install and manage multiple Node.js versions in our dev environments.)
  • An AWS account.
  • AWS CLI version 2 latest version installed.
  • AWS CDK 2 installed and bootstrapped in your AWS account.
  • A local Docker daemon for the AWS CDK to build your containers. If you do not have one, a good choice for getting started is Docker Desktop.

You also need to configure your AWS CLI credentials.

Getting Started

To get started, follow these steps:

  1. Clone this repository locally.

  2. Install the dependencies using yarn install --frozen-lockfile.

  3. Create a Lumigo account and follow the onboarding process.

  4. After you have access to your Lumigo project, retrieve the Lumigo token and store it in an AWS SecretsManager secret:

    aws secretsmanager create-secret --name LumigoToken --secret-string <LumigoToken>
  5. Configure this CDK demo application by adding something like the following in main.ts:

    new AppStack(app, 'aws-cdk-demo-mine' /* stack_name */, {
      env: {
        account: '<account_id>',
        region: '<your_preferred_zone>',
      },
    });

    Important: Make sure that the AWS CDK is bootstrapped for the selected region in the account you choose.

  6. Ensure you have AWS CLI credentials configured for the AWS account id you are going to use.

  7. Deploy the stack using cdk deploy <stack_name>. This command uses the AWS CDK to create all the necessary resources for our stack. If you use multiple AWS accounts and have different profiles for your AWS CLI, pass the right one to the CDK by doing cdk deploy <stack_name> --profile <profile_name>

  8. Verify the deployed stack by checking the output from the cdk deploy command.

  9. Trigger the Lambda function by sending an event to EventBridge. You should see the logs being sent to Lumigo, which provides observability into the AWS resources used by the stack.

Project Structure

The project is structured as follows:

  • src/main.ts: This file contains the main entry point of the application.
  • src/stack.ts: This file contains the AWS resources to be created using the AWS CDK.
  • src/stack.Handler.ts: This file contains the source code for the Lambda function.
  • src/ecs.ts: This file defines the Amazon ECS cluster and task definitions using AWS CDK.
  • ecs-app/: This directory contains the Spring Boot app and the Dockerfile used to build the Amazon ECS container image.

Conclusion

We hope you enjoy this demo, and that it will improve your understanding of how you can develop and deploy non-trivial cloud applications on AWS, and get them monitored seamlessly with Lumigo.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published