hands-on lab

Importing AWS CloudFormation Templates into the AWS CDK

Intermediate
30m
171
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.
Lab 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

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
About the author
Avatar
Jun Fritz, opens in a new tab
Cloud Labs Developer
Students
39,397
Labs
105
Courses
1
Learning paths
6

Jun is a Cloud Labs Developer with previous experience as a Software Engineer and Cloud Developer. He holds the AWS Certified Solutions Architect and DevOps Engineer Professional certifications. He also holds the AWS Certified Solutions Architect, Developer, and SysOps Administrator Associate certifications. 

Jun is focused on giving back to the growing cloud community by sharing his knowledge and experience with students and creating engaging content. 

Covered topics
Lab steps
Setting up the AWS CDK Project
Importing AWS CloudFormation Resources Using the AWS CDK