Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autoscaling): add new HealthChecks for multiple health check types, including EBS and VPC_LATTICE types #31286

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

go-to-k
Copy link
Contributor

@go-to-k go-to-k commented Sep 2, 2024

Issue # (if applicable)

Closes #31289 .

Reason for this change

Only ONE HealthCheckType can be selected for an existing healthCheck property: EC2 or ELB.

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts#L233

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts#L2232-L2258

However, the current CFn specification allows multiple health check types to be specified, separated by commas.

A comma-separated value string of one or more health check types.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-autoscalinggroup.html#cfn-autoscaling-autoscalinggroup-healthchecktype

Also, besides EC2 and ELB, EBS and VPC_LATTICE can now be configured.

The valid values are EC2, EBS, ELB, and VPC_LATTICE. EC2 is the default health check and cannot be disabled.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-autoscalinggroup.html#cfn-autoscaling-autoscalinggroup-healthchecktype

If it was just EC2 and ELB, there would not be a need for multiple specifications. (Because specifying EC2 and another type at the same time would result in a CFn error. This means that when specifying an ELB, it is a single specification.)

But the increase in the number of these property types makes multiple specifications necessary. Therefore, it is good to support the specification of multiple health check types and the addition of new types at the same time.

See the docs for more details.

https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-health-checks.html

Description of changes

So, I add a new HealthChecks class and healthChecks property.

  • One or more health check types can be selected.
  • Added EBS and VPC_LATTIC types.

And I deprecated the existing healthCheck property.

Description of how you validated changes

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

@go-to-k go-to-k changed the title feat(autoscaling): add new HealthChecks instead of old HealthCheck feat(autoscaling): add new HealthChecks instead of old HealthCheck Sep 2, 2024
@github-actions github-actions bot added p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Sep 2, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team September 2, 2024 11:02
@go-to-k go-to-k changed the title feat(autoscaling): add new HealthChecks instead of old HealthCheck feat(autoscaling): add new HealthChecks for multiple health check types, including EBS and VPC_LATTICE types Sep 2, 2024
@go-to-k go-to-k marked this pull request as ready for review September 2, 2024 11:28
Comment on lines +2355 to +2371
/**
* Additional Health Check Type
*/
export enum AdditionalHealthCheckType {
/**
* ELB Health Check
*/
ELB = 'ELB',
/**
* EBS Health Check
*/
EBS = 'EBS',
/**
* VPC LATTICE Health Check
*/
VPC_LATTICE = 'VPC_LATTICE',
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EC2 had to be excluded because specifying EC2 and other types together would result in a CFn error.

Resource handler returned message: "Specifying EC2 in addition to other health check types is not supported. Remove EC2 from HealthCheckType and try again. (Service: AutoScaling, Status Code: 400, Request ID: ...

* @default Duration.seconds(0)
* @see https://docs.aws.amazon.com/autoscaling/ec2/userguide/health-check-grace-period.html
*/
readonly grace?: Duration;
Copy link
Contributor Author

@go-to-k go-to-k Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grace has to be specified in the existing ELB options, but this is not necessary now. (I actually deployed the configuration without the grace successfully).

https://github.com/aws/aws-cdk/pull/31286/files#diff-752c40239355facf5c8611bb25a389d92835db38a094213fdc6ed47c49aa9652R41-R45

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 2, 2024
@github-actions github-actions bot added the feature-request A feature should be added or improved. label Sep 2, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 43f5860
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-autoscaling: specify multiple health check types including EBS and VPC_LATTICE types
2 participants