banner

KuchBhiLearning - A free website to learn and code

This is a good learning site. This contains details of cloud computing, AWS, AWS-CDK, AWS-SDK codes and examples including S3, Redis, lambda, api-gateway, cloudfront, cloudformation.

 AWS-CDK

Let's learn about AWS CDK, a framework for defining cloud infrastructure in code(Using languages such as Python, .Net, GO, Java and Typescript) and provisioning it through AWS CloudFormation.

The AWS CDK lets you build reliable, scalable, cost-effective applications in the cloud. This approach provides many benefits, including:

  • Defining more infrastructure with less code.

  • Use programming idioms like parameters, conditionals, loops and inheritance to convert your system design from building blocks provided by AWS and others.

  • Keep your infrastructure, application code, and configuration all in one place, this helps ensuring you have complete setup of infra, functional and cloud-deployable system.

  • You can also write unit test cases for infra, just like any functional code/services.

  • Use AWS Cloud Formation to perform infrastructure deployments, with rollback on error.


For more benefits check AWS-CDK .




Why use AWS-CDK?

It's easier to show than to explain! Here's some CDK code that creates an vpc instance.

import * as ec2 from 'aws-cdk-lib/aws-ec2';export class MyVpcConstructStack extends Stack {
  constructor(scope: App, id: string, props?: StackProps) {
    super(scope, id, props);

    const vpc = new ec2.Vpc(this, "MyVpc", {
      maxAzs: 3, // Default is all AZs in region
      cidr: '10.0.0.0/21',
      subnetConfigurations:[
        {
            subnetType: ec2.SubnetType.PUBLIC,
            cidrMask: 24
        },
      ];
    });
  }
}

The AWS CDK supports TypeScript, JavaScript, Python, Java, C#/.Net, and Go. Developers can use one of these supported programming languages to define reusable cloud components known as Constructs. You compose these together into Stacks and Apps.

We have covered a basic use case and implementation of AWS CDK.

If you have understood this you can start writing CDK code 👍😃.




No comments:

Post a Comment

If you have any doubts, Please let me know

Copyright 2022, KuchBhiLearning - A free website to learn and code. All rights Reserved.
| Designed by Yaseen Shariff