DEV Community

Discussion on: Deploying a SPA using aws-cdk (TypeScript)

Collapse
 
danko56666 profile image
Daniel Ko

I'm surprised this hasn't gotten more attention, but anyways...other than the benefit of being able to use a programming language of choice, can you list other benefits there are to using cdk over terraform? How's quality of docs? How much support is there when one gets stuck? Is cdk widely used and reliable? Would love to hear your thoughts.

Oh and one unrelated question. How much knowledge of cloudformation is needed to use cdk?

Collapse
 
ryands17 profile image
Ryan Dsouza

Hey Daniel 👋
Thanks for enjoying the article.

can you list other benefits there are to using cdk over terraform?

Another great advantage is super less code to create something than either Terraform or Cloudformation.
For e.g. this is what it takes to create a VPC with 2 public and 2 private subnets:

const vpc = new ec2.Vpc(this, 'serverless-app', {
      cidr: '10.0.0.0/20',
      natGateways: 0,
      maxAzs: 2,
      enableDnsHostnames: true,
      enableDnsSupport: true,
      subnetConfiguration: [
        {
          cidrMask: 22,
          name: 'public',
          subnetType: ec2.SubnetType.PUBLIC,
        },
        {
          cidrMask: 22,
          name: 'private',
          subnetType: ec2.SubnetType.ISOLATED,
        },
      ],
})
Enter fullscreen mode Exit fullscreen mode

Compare it to the code you write with Terraform and you'll see the difference. CDK gives you simple and easy constructs to create such resources.

How's quality of docs? How much support is there when one gets stuck? Is cdk widely used and reliable?

Docs are good and the support is great. There's a CDK Slack channel here that you can join which is awesome and people there are very helpful. Also CDK is widely used as an upgrade over Cloudformation in a great way. You can go ahead and use it in production quite easily as it's simple to setup.

How much knowledge of cloudformation is needed to use cdk?

I would say it's recommended to have basic knowledge of Cloudformation because what CDK creates under the hood is a Cloudformation template.

Let me know if this helps :)

Collapse
 
danko56666 profile image
Daniel Ko

Sweet yea!
I do have basic understanding of cloudformation, if you can even call it that, from playing around with the serverless framework and I do plan to learn more about it eventually. It's just as of right now I am not very familiar with it.

As an aside have you played around with Pulumi at all?

Thread Thread
 
ryands17 profile image
Ryan Dsouza

Unfortunately not, just Cloudformation and Terraform apart from CDK