The AWS CDK is a software development framework used to define cloud infrastructure as code and provision it through CloudFormation. The CDK integrates fully with AWS services and allows developers to use a high-level construct to define cloud infrastructure in code.

In this article, we will build a CDK version of AWS EC2 Instance Scheduler solution that enables us to easily configure custom start and stop schedules for our Amazon EC2 and Amazon RDS instances.

The Architecture

By the end of this article, we will have a pipeline to deploy a serverless solution that starts and stops Amazon EC2 instances in an autoscaling group and Amazon RDS instances based on a schedule.

Here’s the architecture diagram:

Image for post

Through the article we will be covering the following actions:

  • Deploying an AWS Step Function with two parallel tasks.
  • Creating an SNS topic to send notifications.
  • Creating a Cloudeatch event rule which will trigger Step Function based on a schedule.
  • Creating a CI/CD pipeline with CodeBuild and CodePipeline.

Prerequisites

To deploy the CDK application, there are a few prerequisites that need to be met:

  • Setup an AWS account.
  • Install the latest aws-cli.
  • Install AWS CDK CLI.
  • Deploy a multi-AZ WordPress website with RDS (optional).

#aws #step-functions #serverless #cdk

Creating a Instance Scheduler using AWS CDK
3.10 GEEK