Book Image

AWS CDK in Practice

By : Mark Avdi, Leo Lam
Book Image

AWS CDK in Practice

By: Mark Avdi, Leo Lam

Overview of this book

As cloud applications are becoming more complex, multiple tools and services have emerged to cater to the challenges of running reliable solutions. Although infrastructure as code, containers, and orchestration tools, such as Kubernetes, have proved to be efficient in solving these challenges, AWS CDK represents a paradigm shift in building easily developed, extended, and maintained applications. With AWS CDK in Practice, you’ll start by setting up basic day-to-day infrastructure while understanding the new prospects that CDK offers. You’ll learn how to set up pipelines for building CDK applications on the cloud that are long-lasting, agile, and maintainable. You’ll also gain practical knowledge of container-based and serverless application development. Furthermore, you’ll discover how to leverage AWS CDK to build cloud solutions using code instead of configuration files. Finally, you’ll explore current community best practices for solving production issues when dealing with CDK applications. By the end of this book, you’ll have practical knowledge of CDK, and you’ll be able to leverage the power of AWS with code that is simple to write and maintain using AWS CDK.
Table of Contents (17 chapters)
Part 1: An Introduction to AWS CDK
Part 2: Practical Cloud Development with AWS CDK
Part 3: Serverless Development with AWS CDK
Part 4: Advanced Architectural Concepts

Running the tests

This chapter’s code comes with a few fine-grained tests and snapshot tests preconfigured so that you can go through the exercise of running these tests. These tests are by no means exhaustive (meaning covering all the functionality) and this might not be the optimal way to configure tests in your project. However, hopefully, this will inspire you to improve. Let’s take a look at how to run this chapter’s tests.

Configuring the environments

Just like in the previous chapter, when we were running our CDK stack for various environments, we need to create a .env file in the infrastructure directory of chapter 6 to pass some values about the deployment to test the stack. We will name this file .env.testing so that it only gets picked up when we are running the tests. So, go ahead and create a .env.testing file under the infrastructure directory and fill it with values similar to the ones in the Chapter 5 .env files: