npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@otocolobus/aws-cdk-serverbluegreendeploymentgroup

v1.0.3

Published

[![View on Construct Hub](https://constructs.dev/badge?package=%40otocolobus%2Faws-cdk-serverbluegreendeploymentgroup)](https://constructs.dev/packages/@otocolobus/aws-cdk-serverbluegreendeploymentgroup)

Downloads

268

Readme

EC2/On-Premise Server Blue/Green Deployment Group construct

View on Construct Hub

GitHub Actions Workflow Status NPM Downloads NPM License

This construct creates a CodeDeploy Deployment Group for an EC2/On-Premises Deployment Group using the Blue/Green Deployment configuration.

ATTENTION: At the moment, this construct only supports the EC2 deployments with Auto Scaling Groups. The construct does not support neither the EC2 tag-based deployments nor the On-Premises tag-based deployments.

Table of Contents

Overview

Blue/Green deployments is popular deployment strategy that allows you to deploy your application to a new set of instances while keeping the old set of instances running. This allows you to switch traffic from the old set of instances to the new set of instances in a controlled manner.

This construct creates a CodeDeploy Deployment Group for an EC2 using the Blue/Green deployment configuration. The Deployment Group is associated with an Auto Scaling Group and a Load Balancer Target Group.

When a deployment is triggered, the Deployment Group will create a new Auto Scaling Group with the same configuration as the original Auto Scaling Group. The new Auto Scaling Group is called the Green Fleet. The Deployment Group will deploy the new revision of the application to the Green Fleet. After the deployment is successful, the Deployment Group will switch the traffic from the original Auto Scaling Group (Blue Fleet) to the Green Fleet. The Deployment Group will then terminate the instances in the original Auto Scaling Group (if configured to do so). The Deployment Group will wait for the original instances to be terminated before marking the deployment as successful.

You can configure the deployment to automatically rollback if the deployment fails, if the deployment is stopped, or if the deployment is in alarm.

Installation

NPM package: https://www.npmjs.com/package/@otocolobus/aws-cdk-serverbluegreendeploymentgroup

npm install @otocolobus/aws-cdk-serverbluegreendeploymentgroup

PyPI package: https://pypi.org/project/aws-cdk-serverbluegreendeploymentgroup/

pip install aws-cdk-serverbluegreendeploymentgroup

Usage

import { ServerBlueGreenDeploymentGroup } from "@otocolobus/aws-cdk-serverbluegreendeploymentgroup";

class MyStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    // ... other resources for LoadBalancer, AutoScalingGroup, etc.

    const application = new codedeploy.ServerApplication(this, "Application", {
      applicationName: "MyApplication",
    });

    // role required by CodeDeploy to do Blue/Green deployments with EC2 Auto Scaling Groups
    const role = new iam.Role(this, "Role", {
      assumedBy: new iam.ServicePrincipal("codedeploy.amazonaws.com"),
      managedPolicies: [
        iam.ManagedPolicy.fromAwsManagedPolicyName("service-role/AWSCodeDeployRole"),
      ],
      inlinePolicies: {
        ASGWithLaunchTemplate: new iam.PolicyDocument({
          statements: [
            new iam.PolicyStatement({
              actions: [
                "ec2:CreateTags",
                "ec2:RunInstances",
                "iam:PassRole",
                "ssm:GetParameters",
              ],
              resources: ["*"],
            }),
          ],
        }),
      },
    });

    const deploymentGroup = new ServerBlueGreenDeploymentGroup(
      this,
      "DeploymentGroup",
      {
        application,
        deploymentGroupName: "DeploymentGroup",
        role,
        loadBalancers: [
          codedeploy.LoadBalancer.application(loadBalancerTargetGroup),
        ],
        autoScalingGroups,
        // ... other optional properties
      },
    );

    // ... other resources for CodeDeploy and CodePipeline
    // where buildOutput is the output of the CodeBuild action

    pipeline.addStage({
      stageName: "Deploy",
      actions: [
        new codepipeline_actions.CodeDeployServerDeployAction({
          actionName: "Deploy",
          input: buildOutput,
          deploymentGroup,
        });
      ],
    });
  }
}

Limitations

Currently, it is not possible to update the Deployment Group name after the deployment group is created.

Currently, it is not possible to create a Deployment Group for an EC2 or On-Premises deployment with the tag-based configuration.

Author

Władysław Czyżewski (https://otocolobus.com)

License

This project is licensed under the MIT License - see the LICENSE file for details.