{"id":23041330,"url":"https://github.com/otocolobus-com/aws-cdk-serverbluegreendeploymentgroup","last_synced_at":"2025-08-14T21:31:39.184Z","repository":{"id":255021423,"uuid":"836239361","full_name":"otocolobus-com/aws-cdk-serverbluegreendeploymentgroup","owner":"otocolobus-com","description":"AWS CDK's construct for creating a CodeDeploy Deployment Group with Blue/Green deployment configuration for EC2/On-Premises servers. It enables controlled traffic switching between old and new instances, automatic rollback on failure, and more.","archived":false,"fork":false,"pushed_at":"2024-08-31T15:02:55.000Z","size":148,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-12-09T17:40:17.021Z","etag":null,"topics":["auto-scaling-group","aws","aws-cdk","aws-codedeploy","awscdk","bluegreen","bluegreen-deployment","ec2","on-premise"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/otocolobus-com.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-31T12:40:08.000Z","updated_at":"2024-09-30T19:32:25.000Z","dependencies_parsed_at":"2024-08-27T15:28:33.414Z","dependency_job_id":"27dfd65b-ee4b-4406-9c4e-5a598f56ee45","html_url":"https://github.com/otocolobus-com/aws-cdk-serverbluegreendeploymentgroup","commit_stats":null,"previous_names":["otocolobus-com/aws-cdk-serverbluegreendeploymentgroup"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otocolobus-com%2Faws-cdk-serverbluegreendeploymentgroup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otocolobus-com%2Faws-cdk-serverbluegreendeploymentgroup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otocolobus-com%2Faws-cdk-serverbluegreendeploymentgroup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otocolobus-com%2Faws-cdk-serverbluegreendeploymentgroup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/otocolobus-com","download_url":"https://codeload.github.com/otocolobus-com/aws-cdk-serverbluegreendeploymentgroup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229865901,"owners_count":18136382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-scaling-group","aws","aws-cdk","aws-codedeploy","awscdk","bluegreen","bluegreen-deployment","ec2","on-premise"],"created_at":"2024-12-15T19:32:30.297Z","updated_at":"2024-12-15T19:32:30.900Z","avatar_url":"https://github.com/otocolobus-com.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EC2/On-Premise Server Blue/Green Deployment Group construct\n\n[![View on Construct Hub](https://constructs.dev/badge?package=%40otocolobus%2Faws-cdk-serverbluegreendeploymentgroup)](https://constructs.dev/packages/@otocolobus/aws-cdk-serverbluegreendeploymentgroup)\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/otocolobus-com/aws-cdk-serverbluegreendeploymentgroup/.github%2Fworkflows%2Frelease.yml) ![NPM Downloads](https://img.shields.io/npm/d18m/%40otocolobus%2Faws-cdk-serverbluegreendeploymentgroup) ![NPM License](https://img.shields.io/npm/l/%40otocolobus%2Faws-cdk-serverbluegreendeploymentgroup)\n\nThis construct creates a CodeDeploy Deployment Group for an EC2/On-Premises Deployment Group using the Blue/Green Deployment configuration.\n\n**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.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Limitations](#limitations)\n- [Author](#author)\n- [License](#license)\n\n## Overview\n\nBlue/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.\n\nThis 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.\n\nWhen 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.\nAfter 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).\nThe Deployment Group will wait for the original instances to be terminated before marking the deployment as successful.\n\nYou can configure the deployment to automatically rollback if the deployment fails, if the deployment is stopped, or if the deployment is in alarm.\n\n## Installation\n\nNPM package: https://www.npmjs.com/package/@otocolobus/aws-cdk-serverbluegreendeploymentgroup\n\n```bash\nnpm install @otocolobus/aws-cdk-serverbluegreendeploymentgroup\n```\n\nPyPI package: https://pypi.org/project/aws-cdk-serverbluegreendeploymentgroup/\n\n```bash\npip install aws-cdk-serverbluegreendeploymentgroup\n```\n\n## Usage\n\n```ts\nimport { ServerBlueGreenDeploymentGroup } from \"@otocolobus/aws-cdk-serverbluegreendeploymentgroup\";\n\nclass MyStack extends Stack {\n  constructor(scope: Construct, id: string, props?: StackProps) {\n    super(scope, id, props);\n\n    // ... other resources for LoadBalancer, AutoScalingGroup, etc.\n\n    const application = new codedeploy.ServerApplication(this, \"Application\", {\n      applicationName: \"MyApplication\",\n    });\n\n    // role required by CodeDeploy to do Blue/Green deployments with EC2 Auto Scaling Groups\n    const role = new iam.Role(this, \"Role\", {\n      assumedBy: new iam.ServicePrincipal(\"codedeploy.amazonaws.com\"),\n      managedPolicies: [\n        iam.ManagedPolicy.fromAwsManagedPolicyName(\"service-role/AWSCodeDeployRole\"),\n      ],\n      inlinePolicies: {\n        ASGWithLaunchTemplate: new iam.PolicyDocument({\n          statements: [\n            new iam.PolicyStatement({\n              actions: [\n                \"ec2:CreateTags\",\n                \"ec2:RunInstances\",\n                \"iam:PassRole\",\n                \"ssm:GetParameters\",\n              ],\n              resources: [\"*\"],\n            }),\n          ],\n        }),\n      },\n    });\n\n    const deploymentGroup = new ServerBlueGreenDeploymentGroup(\n      this,\n      \"DeploymentGroup\",\n      {\n        application,\n        deploymentGroupName: \"DeploymentGroup\",\n        role,\n        loadBalancers: [\n          codedeploy.LoadBalancer.application(loadBalancerTargetGroup),\n        ],\n        autoScalingGroups,\n        // ... other optional properties\n      },\n    );\n\n    // ... other resources for CodeDeploy and CodePipeline\n    // where buildOutput is the output of the CodeBuild action\n\n    pipeline.addStage({\n      stageName: \"Deploy\",\n      actions: [\n        new codepipeline_actions.CodeDeployServerDeployAction({\n          actionName: \"Deploy\",\n          input: buildOutput,\n          deploymentGroup,\n        });\n      ],\n    });\n  }\n}\n```\n\n## Limitations\n\nCurrently, it is not possible to update the Deployment Group name after the deployment group is created.\n\nCurrently, it is not possible to create a Deployment Group for an EC2 or On-Premises deployment with the tag-based configuration.\n\n## Author\n\n[Władysław Czyżewski](https://github.com/wladyslawczyzewski) (https://otocolobus.com)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fotocolobus-com%2Faws-cdk-serverbluegreendeploymentgroup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fotocolobus-com%2Faws-cdk-serverbluegreendeploymentgroup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fotocolobus-com%2Faws-cdk-serverbluegreendeploymentgroup/lists"}