AWS CDK in Practice

Book description

Uncover the secrets of building maintainable, extensible, and virtually indestructible cloud applications on AWS with Cloud Development Kit (CDK) Purchase of the print or Kindle book includes a free PDF eBook

Key Features

  • Build complex cloud applications with the revolutionary AWS CDK
  • Gain practical knowledge of AWS CDK to leverage the powerful toolset of AWS
  • Employ practical exercises & architectural design patterns for developing modern serverless application

Book Description

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.

What you will learn

  • Turn containerized web applications into fully managed solutions
  • Explore the benefits of building DevOps into everyday code with AWS CDK
  • Uncover the potential of AWS services with CDK
  • Create a serverless-focused local development environment
  • Self-assemble projects with CI/CD and automated live testing
  • Build the complete path from development to production with AWS CDK
  • Become well versed in dealing with production issues through best practices

Who this book is for

This book is for traditional full stack developers looking to explore the new world of Infrastructure as Code and serverless applications, solutions architects seeking to define their services with AWS CDK, and DevOps specialists searching for a better management technique to configure files. Readers should not be new to coding and must have experience in web development in languages such as Python, JS, Typescript, Java, etc. along with a basic understanding of how web applications are developed.

Table of contents

  1. AWS CDK in Practice
  2. Contributors
  3. About the authors
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Technologies covered in this book
      2. Operating system requirements
    4. Download the example code files
    5. Code in Action
    6. Download the color images
    7. Conventions used
    8. Get in touch
    9. Share Your Thoughts
    10. Download a free PDF copy of this book
  6. Part 1: An Introduction to AWS CDK
  7. Chapter 1: Getting Started with IaC and AWS CDK
    1. Technical requirements
    2. Introduction to AWS CDK
    3. Setting up your local environment and writing your first CDK app
      1. Setting up the AWS CLI and profile
      2. Setting up the AWS CDK CLI
    4. Creating a containerized web application in AWS CDK using Docker
    5. Understanding the inner workings of AWS CDK
    6. Summary
  8. Chapter 2: A Starter Project and Core Concepts
    1. Technical requirements
    2. The CDK monorepo model
      1. High-level separation of concepts
    3. CDK concepts
      1. A CDK app
      2. The organization of constructs
      3. The Construct Hub
    4. Summary
  9. Part 2: Practical Cloud Development with AWS CDK
  10. Chapter 3: Building a Full Stack Application with CDK
    1. Setting up and building the stack
      1. Frontend
      2. Backend
    2. Fixing the frontend code
    3. Examining the CDK code
      1. DynamoDB table
      2. S3 bucket
      3. ECS setup
    4. Summary
  11. Chapter 4: Complete Web Application Deployment with AWS CDK
    1. Technical requirements
    2. DNS with Route 53
      1. Configuring the project
      2. Completing the AWS console journey
    3. MySQL powered by AWS RDS
      1. Storing secrets
      2. ACM certificate
      3. Glue code
    4. Summary
  12. Chapter 5: Continuous Delivery with CDK-Powered Apps
    1. Introduction to CI/CD
      1. What is continuous integration (CI)?
      2. What is continuous delivery (CD)?
      3. AWS’s CI/CD toolset
    2. Technical requirements
      1. GitHub personal access token
      2. Slack integration steps
    3. Creating various environments
    4. Implementing a robust CI/CD process
    5. Summary
  13. Chapter 6: Testing and Troubleshooting AWS CDK Applications
    1. Technical requirements
    2. Understanding the terms of testing
    3. Various ways of testing CDK apps
    4. Running the tests
      1. Configuring the environments
      2. Assertion tests
      3. Snapshot tests
    5. Examining CDK deployment logs
    6. Debugging CDK apps using VSCode
    7. Troubleshooting common problems with CDK
      1. Bootstrapping
      2. IAM permissions
      3. Too many resources on the CloudFormation template
      4. Non-deleted resources
    8. Summary
  14. Part 3: Serverless Development with AWS CDK
  15. Chapter 7: Serverless Application Development with AWS CDK
    1. Technical requirements
    2. Configuring the project
    3. What is serverless?
      1. Creating an API with AWS Lambda and API Gateway
      2. Creating a health check path
      3. Lambda function integration
    4. Completing and deploying the serverless backend
      1. Creating a GET and POST route to perform DynamoDB operations
      2. Simplifying the Lambda integration
      3. Creating and configuring a DynamoDB instance
    5. Introduction to Step Functions
    6. Summary
  16. Chapter 8: Streamlined Serverless Development
    1. Technical requirements
    2. Configuring the project
    3. Common problems with serverless development
    4. Running Lambda application logic locally
    5. Using LocalStack to simulate AWS services
      1. Installing LocalStack
      2. Starting LocalStack
      3. Configuring DynamoDB to work with LocalStack
    6. Limitations of LocalStack
    7. Summary
  17. Part 4: Advanced Architectural Concepts
  18. Chapter 9: Indestructible Serverless Application Architecture (ISAA)
    1. Technical requirements
    2. What is ISAA?
    3. ISAA principles
      1. A fuller stack
      2. Serverless
      3. Simplicity
      4. Event-driven architecture
    4. Challenges with ISAA
      1. Runaway costs
      2. Lack of openness
    5. Advantages of ISAA
    6. Summary
  19. Chapter 10: The Current CDK Landscape and Outlook
    1. Advanced ways that CDK is leveraged
      1. Creating multiple CDK stacks
      2. Dynamic provisioning
      3. CDK for larger organizations
    2. CDK for other platforms
      1. Pulumi
      2. CDKTF
      3. CDK8S
      4. Serverless Stack Toolkit
      5. ISAA on Kubernetes
    3. Where to go from here
    4. Summary
  20. Index
    1. Why subscribe?
  21. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts
    3. Download a free PDF copy of this book

Product information

  • Title: AWS CDK in Practice
  • Author(s): Mark Avdi, Leo Lam
  • Release date: June 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781801812399