hands-on lab

Importing AWS CloudFormation Templates into the AWS CDK

Difficulty: Intermediate
Duration: Up to 30 minutes
Students: 179
Rating: 5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

Transitioning from using AWS CloudFormation to developing applications with the AWS CDK can be a daunting task. Luckily, the AWS CDK offers a solution that can assist in importing and migrating existing CloudFormation templates.

Instead of manually defining these resources using their matching class, developers can utilize the AWS CDK cloudformation-include class to import a stack template and convert resource definitions to L1 constructs.

In this lab, you will use the CfnInclude class to import a predefined website-hosting Amazon S3 bucket into a CDK stack. You will also explore the configuration options available to you after the resources have been successfully imported.

Learning Objectives

Upon completion of this intermediate-level lab, you will be able to:

  • Import an existing AWS CloudFormation template into a CDK application
  • Access an imported template's elements within a CDK application

Intended Audience

  • Cloud Architects
  • DevOps Engineers
  • Software Engineers

Prerequisites

Familiarity with the following will be beneficial but is not required:

  • AWS CDK
  • Amazon S3
  • AWS CloudFormation

The following content can be used to fulfill the prerequisite:

Updates

June 13th, 2024 - Resolved IAM permission issue

April 17th, 2024 - Resolved IAM permission issue

August 16th, 2023 - Remove Node deprecation warning and updated CDK CLI version

March 13th, 2023 - Enabled autosave in the lab's browser IDE

Environment before

Environment after

Covered topics

Lab steps

Setting up the AWS CDK Project
Importing AWS CloudFormation Resources Using the AWS CDK