Git Product home page Git Product logo

cdk-deployment-constructs's Introduction

CDK Deployment Constructs

NPM version

CDK constructs for safe deployment of code via AWS CodeSuite.

  • Disable/enable CodePipeline transitions based on one or more SSM Change Calendars
  • Bake steps with support for alarms

Installation

TypeScript

https://www.npmjs.com/package/cdk-deployment-constructs

In your package.json:

{
  "dependencies": {
    "cdk-deployment-constructs": "^0.0.0",

    // peer dependencies of cdk-deployment-constructs
    "aws-cdk-lib": "^2.18.0",
    "constructs": "^10.0.5"

    // ...your other dependencies...
  }
}

Features

You can browse the documentation at https://constructs.dev/packages/cdk-deployment-constructs/.

Bake steps

A bake step is an approval step, usually added post deployments, which intentionally slows down the pipeline a fixed amount of time. This "bake time" can help surface issues that only arise some time after deployment, either due to sporadic usage or uptime-related causes (e.g. memory leaks). One or more CloudWatch alarms can be optionally associated with the bake step, in which case the enforcer will reject the approval if any of them goes into alarm during the bake time.

import * as pipelines from 'aws-cdk-lib/pipelines';
import * as dc from 'cdk-deployment-constructs';

declare const pipeline: pipelines.CodePipeline;
declare const helper: dc.CodePipelineHelper;

const wave = pipeline.addWave("Wave1");
wave.addPost(
  helper.newBakeStep("Bake-Wave1", {
    bakeTime: Duration.hours(2),
  })
);

Contributing/Security

See CONTRIBUTING.md for more information.

License

This project is licensed under the MIT License.

cdk-deployment-constructs's People

Contributors

openwebsolns avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar  avatar Shahar Dahan avatar  avatar

cdk-deployment-constructs's Issues

Do not require esbuild for assets

Problem

As a consumer of this library, I should not require esbuild to be installed to use it.

Solution

Borrow CDK's solution for log retention custom resource by using s3.Asset() instead. Refactor the function to live in a directory instead and thus make each portion more unit testable.

Publish continuous metrics on blocked pipelines

Problem

As a pipeline owner, I'd like metrics whenever my pipeline is blocked. The best built-in mechanism for this today in AWS is to publish an event on detail "CodePipeline Pipeline Execution State Changed" with state "FAILED"; then create an alarm around the AWS Events metrics for this rule. The problem is that this metric only exists when there is a state change, which means that the state of the alarm does not reflect the current state of the pipeline.

Solution

By having the enforcer emit metrics on every execution as to the state of the pipeline, we get a steady stream of metric values that can be used for continuous monitoring of the pipeline's health, without incurring AWS Events involvement.

Requirements

Ergonomics

  • DeploymentSafetyEnforcer should accept a new setting for "pipelineMetrics" that allows the customer to enable/disable the feature. Because we are publishing custom metrics, which are not free, we do not want to enable by default
  • The pipeline metrics configuration should allow the customer to override the CloudWatch metrics namespace, with default value DeploymentSafetyEnforcer.
  • Construct should expose a metricPipelineFailed() method, akin to CDK's DynamoDB Table construct, which exposes the metric value for easy alarm creation (alarm creation is outside the scope and better suited for cdk-monitoring-constructs).
  • Metric should use PipelineName as the dimension
  • To start, metric name should be PipelineBlocked

Potentially, in the future, we may enable more fine-grained metrics such as "StageBlocked", etc.

Upgrade Lambda runtime to Node18

Problem

Node16 is on a deprecation path, with Lambda deprecating the runtime as of June 2024. We should aim to be ahead of the curve and update our Lambda runtime to run on Node 18.

Right now we use the default aws-sdk runtime in a Lambda container image. We will either need to bundle in the aws-sdk ourselves (not preferred), or update the code to use the AWS Javascript SDKv3 (preferred).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.