Page updated Jan 16, 2024

AWS CDK v1 to v2 migration

AWS CDK version should match the CDK version that cli-extensibility-helper package uses as a dependency in amplify/backend/custom/customResourceName/package.json.

You can verify the aws-cdk-lib version that @aws-amplify/cli-extensibility-helper uses in the amplify/backend/package.json file.

AWS Cloud Development Kit (CDK) version 1 that Amplify CLI uses under the hood has entered maintenance on June 1, 2022 with end of support date scheduled on June 1, 2023. Amplify CLI v11 and above uses CDK v2 to help you move away from deprecated CDK as well as unblock new features that won’t be added to version 1 of CDK. To learn more about AWS CDK Migration, visit Migrating to V2

When to migrate

During deployment, Amplify CLI searches for AWS CDK v1 dependencies in your project and if found, Amplify CLI prints a warning to migrate to AWS CDK v2.

1We detect you are using CDK v1 with custom stacks and overrides. AWS CDK v1 has entered maintenance mode on June 1, 2022
2
3Impacted files.
4 - amplify/backend/package.json
5 Upgrade '@aws-amplify/cli-extensibility-helper' to latest version ^3.0.0
6
7 - amplify/backend/custom/<resource-name1>/package.json
8 - amplify/backend/custom/<resource-name2>/package.json
9
10Follow this guide here: https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html

How do I migrate?

If an Amplify project using amplify override <category> or amplify add custom was deployed with an Amplify CLI version prior to 11.0.0, then you need to follow the steps below to migrate:

  1. For projects using amplify overrides <category>: Upgrade @aws-amplify/cli-extensibility-helper to version ^3.0.0 in amplify/backend/package.json

  2. For projects using amplify add custom: Update package.json for custom categories in amplify/backend/custom/<custom-resource-name>/package.json as shown below:

    Amplify overrides warning And update amplify/backend/custom/<custom-resource-name>/cdk-stack.ts for custom categories as shown below:

    Amplify custom warning