Skip to content
Deepjyot Kapoor edited this page Apr 16, 2024 · 2 revisions

Cloud Development Kit

  • infrastructure as code with favorite programming language :) --> python, java, js

  • It's open source.

  • good for developers to create the resources.

  • earlier developers used to develop ,code, test, build | ops team-->deploy,rel, montior [bad communication between 2 teams]

to streamline this process [DevOps --> to streamline the entire process of developemtn and operations] [no human error][automation tells] encourages developers to develop code, deploy it, get feedback from customers after deploying, now iteratively they can do this process [without depending on other team], bcoz all is automated.** Developers are happy :)**

Why CDK?

  • deploy cloud infra in scalable way, everything written easily, readable, no need to go to console and make changes to the resource setting. Time consuming :(
  • reduce human error --> going to console and making a "Bad" setting to the resource.

Steps:

  • cdk init app --language python

  • where to create the resource ( in the file): (Aws calls this stackset)

from aws_cdk import (
    # Duration,
    Stack,
    # aws_sqs as sqs,
)
from constructs import Construct

class Lf1ImageIndexingStack(Stack):

    def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
        super().__init__(scope, construct_id, **kwargs)

        # The code that defines your stack goes here

        # example resource
        # queue = sqs.Queue(
        #     self, "Lf1ImageIndexingQueue",
        #     visibility_timeout=Duration.seconds(300),
        # )

What is stackset? basically, stackset is feature, that allows aws to create these resources across different aws accounts, and regions.

Commands:

  • To bootstrap (Inital process- do it 1st time): AWS_PROFILE=admin-deepjyot cdk bootstrap
  • To create CF template from the code: AWS_PROFILE=admin-deepjyot cdk synth
  • To deploy and create resources: AWS_PROFILE=admin-deepjyot cdk deploy
  • To destroy all resources (force flag to force delete) : AWS_PROFILE=admin-deepjyot cdk destroy --force
image
Clone this wiki locally