question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws cdk lib): CloudFormationDeployments missing in aws-cdk-lib

See original GitHub issue

General Issue

Unable to find CloudFormationDeployments from v1 (exported in 'aws-cdk/lib/api/cloudformation-deployments') in aws-cdk-lib (v2)

The Question

While writing some e2e tests for a library we are using CDK to provision different stacks for each suite to test the behaviour of our library in an actual Lambda execution environment. We are already able to do so using CDK v1 using something along the lines of:

import { App, Stack } from '@aws-cdk/core';
import { SdkProvider } from 'aws-cdk/lib/api/aws-auth';
import { CloudFormationDeployments } from 'aws-cdk/lib/api/cloudformation-deployments';

const integTestApp = new App();
const stack = new Stack(integTestApp, 'ExampleIntegTest');

// Add Constructs

const stackArtifact = integTestApp.synth().getStackByName(stack.stackName);
const sdkProvider = await SdkProvider.withAwsCliCompatibleDefaults({
  profile: process.env.AWS_PROFILE,
});
const cloudFormation = new CloudFormationDeployments({ sdkProvider });

await cloudFormation.deployStack({
  stack: stackArtifact,
});

We would like to migrate this to aws-cdk-lib (v2) to get the benefits of the newer version but we are unable to find SdkProvider and CloudFormationDeployments in the new version, could you confirm their presence and/or provide an alternative for v2?

CDK CLI Version

N/A

Framework Version

2.3.0

Node.js Version

N/A

OS

N/A

Language

Typescript

Language Version

N/A

Other information

Alternatively we have considered using the CloudFormation client from aws-sdk to deploy the synthesised template but in doing so we would lose the hotswap feature which we are using while writing the tests to iterate faster.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
dreamorosicommented, Jan 25, 2022

@rix0rrr @peterwoodworth any chance we could get an answer on whether this is in the plans or not?

Not asking for any kind of ETA, just would like to know if this is something that might become exposed again or if we should just stick with v1 / find an alternative.

We are using this in awslabs/aws-lambda-powertools-typescript to run our end to end tests and being able to migrate to aws-cdk-lib would allow us to manage only one dependency instead of having to bump all the @aws-cdk/aws-* ones from v1.

3reactions
asquitheacommented, Jan 15, 2022

I’ve been using SdkProvider and CloudFormationDeployments to wrap a service around CDK to deploy templated infrastructure on demand. My usage pattern is to use CloudFormationDeployments to upload assets and prepare a CloudFormation change-set, and then use the standard CloudFormation API to execute and monitor that change-set using SNS notifications.

Was aware from the start that these are not in the official API and might be changed without warning - but they are useful nonetheless as without it I would need to replicate all the CDK-specific business logic.

The high-level requirement would be something like: Provide a way to get from .synth() - which produces a CloudAssembly - to one or more CloudFormation change-sets that can be invoked as normal.

I can live without all the monitoring functionality, as that’s really more geared to the CLI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk-lib module - AWS Documentation
AWS Cloud Development Kit Library. The AWS CDK construct library provides APIs to define your CDK application and add CDK constructs to the...
Read more >
Troubleshooting common AWS CDK issues
This topic describes how to troubleshoot the following issues with the AWS CDK. After updating the AWS CDK, the AWS CDK Toolkit (CLI)...
Read more >
Migrating to AWS CDK v2 - AWS Documentation - Amazon.com
AWS CDK v2 consolidates the stable parts of the AWS Construct Library, including the core library, into a single package, aws-cdk-lib .
Read more >
aws-cdk-lib.pipelines module
CDK Pipelines is an opinionated construct library. It is purpose-built to deploy one or more copies of your CDK applications using CloudFormation with...
Read more >
Testing constructs - AWS Cloud Development Kit (AWS CDK) v2
The standard approach to testing AWS CDK apps uses the AWS CDK's assertions ... project using the CDK Toolkit and installing the libraries...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found