amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

support CDK version 2

Open chakch opened this issue 2 years ago • 11 comments

Is this feature request related to a new or existing Amplify category?

New category

Is this related to another service?

No response

Describe the feature you'd like to request

The aws-amplify/cli-extensibility-helper support only the CDK version 1. add the support of CDK version 2 for aws-amplify/cli-extensibility-helper

Describe the solution you'd like

I think it will be better to create new package aws-amplify/cli-extensibility-helper-cdkv2 to have the ability to import resource in an custom cdk stack using v2

Describe alternatives you've considered

Nothing

Additional context

No response

Is this something that you'd be interested in working on?

  • [X] 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • [x] ⚠️ This feature might incur a breaking change

chakch avatar Feb 24 '22 10:02 chakch

The problem extends beyond just cli-extensibility-helper -- indeed you cannot build any custom resources using v2 as the amplify cli uses v1 and complains if it's not there.

joshwand avatar Mar 02 '22 01:03 joshwand

The problem extends beyond just cli-extensibility-helper -- indeed you cannot build any custom resources using v2 as the amplify cli uses v1 and complains if it's not there.

I can build an custom stack using cdk v2 by changing all the dependencies and it's work fine. But When I try to import created resources using the helper, I couldn't, because the helper use the v1 version

chakch avatar Mar 02 '22 17:03 chakch

CDK v1 will enter maintenance mode on June 1, 2022: https://github.com/aws/aws-cdk/issues/19836

AWS CDK v1 will enter Maintenance Mode after June 1, 2022. After this date, we will continue to publish releases to v1 only for critical security updates and critical bug fixes. We will not publish new features or minor bug fixes to v1. See the AWS SDKs and Tools maintenance policy for more detail on what this means.

From a developer experience point of view, using v2 would make it for a much smoother experience. Right now, with v1, when we create a custom resource this comes with the core package and some extras installed (sns, sqs, iam). If I want to create a custom resource that involves other services I have to go to amplify/backend/custom/my_custom_resource/ and add the missing CDK packages. While doing that I also must know and be careful enough to have matching versions or it'll throw errors at build stage. I have to repeat this for each single custom resource.

On the other hand, using v2 would mean having a single dependency aws-cdk-lib that is installed when the custom resource is created (amplify add custom). After that I can jump into my editor & start adding any AWS resource without having to worry about package versions & all.

dreamorosi avatar Apr 27 '22 11:04 dreamorosi

Same. Even more considering what @dreamorosi said. I can't see how this is a P3 when v1 is entering maintenance mode in less than a month…

menendezjaume avatar May 13 '22 11:05 menendezjaume

As @menendezjaume has pointed out.

The CDK v1 goes into "Maintenance" from June 1st 2022 (tomorrow as I write this). From tomorrow it will receive 12 months of "critical bug fixes and security patches only".

On June 1, 2023, support will end entirely for AWS CDK v1

This gives everyone using the CDK v1 at most 12 months to perform their migrations from v1 to v2. Additionally, use of the CDK v1 limits capabilities going forward as "New features will be developed exclusively for CDK v2 during the v1 maintenance phase."

https://docs.aws.amazon.com/cdk/v1/guide/work-with-cdk-v2.html

PhilipWhiteside avatar May 31 '22 16:05 PhilipWhiteside

linking https://github.com/aws-amplify/amplify-cli-export-construct/pull/39

siegerts avatar Jul 28 '22 12:07 siegerts

Thank you @siegerts for linking that PR.

Has the team considered using L1 constructs that are available in CDK v2 instead of holding off the migration/support?

dreamorosi avatar Jul 28 '22 14:07 dreamorosi

@dreamorosi @joshwand @chakch @alex-vladut, @ryanhuff, @tacck, @MattJColes, @sopel, @dreamorosi, @pbv0, @agcty, @iShavgula-TacTill: We are currently working to upgrade to CDK v2. Couple of questions for ya'll:

  1. What commands are you using? (e.g. export, custom, overrides)
  2. If you're using export, do you have any automated CI workflows that depend on this?

swaminator avatar Sep 13 '22 20:09 swaminator

@swaminator from my side custom 90% of the time & overrides 10% of the time.

dreamorosi avatar Sep 13 '22 20:09 dreamorosi

Yes, override. However, as not all properties are supported by overrides, I've been preferring to just go with CDK directly. Some of these are required by app sec teams for projects. My use of Amplify is being trimmed down to client side. It would be great to have seen Amplify create a self contained CDK construct that can be imported into a CDK stack deployed with CDK pipelines. Again, this is not perfect, as it depends on whether a method exists on the resource as CDK doesn't create them, so not all properties are supported then either.

No custom. Instead running a post publish/push/status script to grab ARNs from the Amplify stack and pump them into CDK v2 stack as parameters.

No export. The output doesn't work without the helper from what I tried. I'd expected a functional cfn stack but some of the stacks were not referencing each other (IIRC dynamodb table stack wasn't referenced by api, or something nested like that, this was a short while ago).

PhilipWhiteside avatar Sep 14 '22 06:09 PhilipWhiteside

@dreamorosi do you have sample code on what you're doing with custom? We want to make sure we're tracking all migration scenarios.

swaminator avatar Sep 14 '22 16:09 swaminator

CDK V2 for Amplify is in public preview :) : https://aws.amazon.com/blogs/mobile/use-aws-cdk-v2-with-the-aws-amplify-cli-extensibility-features-beta/

mtliendo avatar Dec 14 '22 22:12 mtliendo

We just shipped @aws-amplify/[email protected] together with @aws-amplify/[email protected] which are on CDKv2.

sobolk avatar Mar 13 '23 22:03 sobolk

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Mar 13 '23 22:03 github-actions[bot]