use aws `cdk synth` output via cloudformation
I would generally not recommend to use the output of cdk synth
via CloudFormation except you know what you are doing very well.
Here is the reason why: There are some edge cases in which the CDK does bootstrapping and asset publishing in advance, e.g. for so called asset sources (docker images, s3 files, etc).
The topic has some overlap with issues in the CDK repository on GitHub asking about CI/CD integration. [1]
There is work in progress to develop a fully automated CI/CD process for the CDK [2]. The so called cloud assembly [3] contains all resources which are necessary to deploy via CloudFormation but as the RFC points out:
The cloud assembly includes a CloudFormation template for each stack and asset sources (docker images, s3 files, etc) that must be packaged and published to the asset store in each environment that consumes them.
If you are not using any assets or have the option to package and deploy them before using CloudFormation, using cdk synth output should be possible in CloudFormation when supplying the correct CFN params (as others have already pointed out in this thread).
References
[1] https://github.com/aws/aws-cdk/issues/6894
[2] https://github.com/aws/aws-cdk-rfcs/blob/master/text/0049-continuous-delivery.md
[3] https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/cloud-assembly-schema/README.md
Yes, it is possible. I have a process which uses the CDK to 'build' the CloudFormation template using cdk synth
. This template is then uploaded into an S3 bucket on a versioned path.
You can then deploy the CloudFormation template from the bucket using the --template-url
option on create-stack
.
https://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html