Answers: <p>Yes: in the <a href="https://docs.aws.amazon.com/cdk/latest/guide/hello_world.html" rel="nofollow noreferrer">hello world CDK example</a>, they call it &quot;synthesizing&quot;:</p>
  <p><code>cdk synth</code></p>
  <p>^^ produces CloudFormation file.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-12-11T13:52:25.030Z
Answers: The only problem is that sometimes `synth` requires online access (if your lambda is in VPC).
Answers: Askar Kalykov
Answers: CC BY-SA 4.0
Answers: 2020-10-30T10:31:32.633Z
Answers: 2020-10-30T10:31:32.633Z
Answers: Ta Mu
Answers: <p>As Tamara had already mentioned, CDK already produces this for you during synthesis. To clarify this further, if you look in the <strong>cdk.out</strong> directory, you'll find a <em>xxxxx.template.json</em> file for every stack.</p>
  <p>This is your synthesized template that CDK passes onto Cloudformation.</p>
  <p>Additionally, you may also benefit from taking a look at <a href="https://docs.aws.amazon.com/cdk/v2/guide/cli.html#cli-diff" rel="nofollow noreferrer">cdk diff</a>.</p>
  <blockquote>
  <p>The cdk diff command compares the current version of a stack defined in your app with the already-deployed version, or with a saved AWS CloudFormation template, and displays a list of changes.</p>
  </blockquote>
  <p>Let me know if you have any further questions!</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-09-15T13:02:39.593Z
Answers: 2022-09-15T13:02:39.593Z
Answers: user981231237
Body: <p>Since I've seen Hashicorp Terraform, I have been wondering why the &quot;plan&quot; it can export has binary format.</p>
  <p>Now in the AWS world you have got a declarative configuration language called CloudFormation which can be abstracted from using AWS CDK (Cloud Development Kit) in a common programming language of your choice.</p>
  <p>Therefore my question: imagine somebody familiar with CloudFormation would like to see what CDK code will do. Is there a way to export a CloudFormation file using CDK?</p>
  
Comments: CC BY-SA 4.0
Comments: 2022-04-09T10:03:22.927Z
Comments: So from your experience there's no way to export CF file from terraform code?
Comments: koalaok
Tags: <amazon-web-services><aws-cloudformation>
Title: Export CloudFormation file from CDK
UserDisplayName: Ta Mu
ThreadText: # Export CloudFormation file from CDK
  
  (Asked by: username_0 on 2020-10-30)
  
  Since I've seen Hashicorp Terraform, I have been wondering why the "plan" it can export has binary format.
  
  Now in the AWS world you have got a declarative configuration language called CloudFormation which can be abstracted from using AWS CDK (Cloud Development Kit) in a common programming language of your choice.
  
  Therefore my question: imagine somebody familiar with CloudFormation would like to see what CDK code will do. Is there a way to export a CloudFormation file using CDK?
  
  **Tags:** amazon-web-services, aws-cloudformation
  
  > **Comments:**
  > **username_1**: So from your experience there's no way to export CF file from terraform code?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-10-30. Score: 0 | Accepted answer
  
  Yes: in the [hello world CDK example](https://docs.aws.amazon.com/cdk/latest/guide/hello_world.html), they call it "synthesizing":
  
  `cdk synth`
  
  ^^ produces CloudFormation file.
  
  > **Comments:**
  > **username_2**: The only problem is that sometimes `synth` requires online access (if your lambda is in VPC).  
  
  ---
  
  ### Answer by username_3 on 2022-09-15. Score: 0
  
  As Tamara had already mentioned, CDK already produces this for you during synthesis. To clarify this further, if you look in the **cdk.out** directory, you'll find a *xxxxx.template.json* file for every stack.
  
  This is your synthesized template that CDK passes onto Cloudformation.
  
  Additionally, you may also benefit from taking a look at [cdk diff](https://docs.aws.amazon.com/cdk/v2/guide/cli.html#cli-diff).
  
  > The cdk diff command compares the current version of a stack defined in your app with the already-deployed version, or with a saved AWS CloudFormation template, and displays a list of changes.
  
  Let me know if you have any further questions!
  
  
  ---
  
  