aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.33k stars 3.76k forks source link

feat(codedeploy): termination hook #30644

Closed badmintoncryer closed 2 days ago

badmintoncryer commented 4 days ago

Issue # (if applicable)

None

Reason for this change

Deployment group supports a termination hook for EC2 compute type but CDK L2 construct does not support this.

Description of changes

Added terminationHook to ServerDeploymentGroupProps

    new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', {
      autoScalingGroups: [
        new autoscaling.AutoScalingGroup(stack, 'ASG', {
          instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL),
          machineImage: new ec2.AmazonLinuxImage(),
          vpc: new ec2.Vpc(stack, 'VPC'),
        }),
      ],
      terminationHook: true, // add
    });

Description of how you validated changes

Added both unit and integ tests

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

badmintoncryer commented 2 days ago

@GavinZZ Thank you for your review! I've addressed your comments.

badmintoncryer commented 2 days ago

I'll update snapshot files later

mergify[bot] commented 2 days ago

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

mergify[bot] commented 2 days ago

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

aws-cdk-automation commented 2 days ago

AWS CodeBuild CI Report

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

mergify[bot] commented 2 days ago

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).