feat(autoscaling): add support for InstanceRequirements property#28464
feat(autoscaling): add support for InstanceRequirements property#28464sumupitchayan merged 6 commits intoaws:mainfrom
InstanceRequirements property#28464Conversation
InstanceRequirements
| /** | ||
| * The instance requirements. Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. | ||
| * Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types. | ||
| * You can specify up to four separate sets of instance requirements per Auto Scaling group. | ||
| * This is useful for provisioning instances from different Amazon Machine Images (AMIs) in the same Auto Scaling group. | ||
| * To do this, create the AMIs and create a new launch template for each AMI. | ||
| * Then, create a compatible set of instance requirements for each launch template. | ||
| * | ||
| * If you specify InstanceRequirements, you can't specify InstanceType. | ||
| * | ||
| * @default - Do not override instance type | ||
| */ |
| if (override.instanceType && override.instanceRequirements) { | ||
| throw new Error('\'InstanceRequirements\' can\'t be specified with \'InstanceType\''); | ||
| } |
There was a problem hiding this comment.
If you specify InstanceRequirements, you can't specify InstanceType.
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
InstanceRequirementsInstanceRequirements property
|
Exemption Request
I add doc comment for
I add test at |
|
Exemption Request I add doc comment for instanceRequirements property |
|
Exemption Request: I add doc comment for instanceRequirements property / I add test at auto-scaling-group.test.ts |
|
@wafuwafu13 please add an integration test or update an existing one |
lpizzinidev
left a comment
There was a problem hiding this comment.
Thanks for starting this.
This is still a work in progress as the property needs to be implemented in the L2 construct directly.
Also, the related documentation, unit, and integration tests are required as this is a new feature.
| * | ||
| * @default - Do not override instance type | ||
| */ | ||
| readonly instanceRequirements?: CfnAutoScalingGroup.InstanceRequirementsProperty |
There was a problem hiding this comment.
We'll need to implement the interface in the L2 construct and not make use of the existing one from L1.
There was a problem hiding this comment.
Do you mean I should define instanceRequirements in another place?
If so, I would be grateful if you could tell me where to define it.
There was a problem hiding this comment.
Nevermind, I got it wrong.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
| * | ||
| * @default - Do not override instance type | ||
| */ | ||
| readonly instanceRequirements?: CfnAutoScalingGroup.InstanceRequirementsProperty |
There was a problem hiding this comment.
Nevermind, I got it wrong.
| throw new Error('Weight must be an integer'); | ||
| } | ||
| if (override.instanceType && override.instanceRequirements) { | ||
| throw new Error('\'InstanceRequirements\' can\'t be specified with \'InstanceType\''); |
There was a problem hiding this comment.
| throw new Error('\'InstanceRequirements\' can\'t be specified with \'InstanceType\''); | |
| throw new Error('You can specify either \'instanceRequirements\' or \'instanceType\', not both.'); |
Message formatting.
| }); | ||
| ``` | ||
|
|
||
| You can specify instance requirements in `InstanceRequirements`: |
There was a problem hiding this comment.
| You can specify instance requirements in `InstanceRequirements`: | |
| You can specify instances requirements with the `instanceRequirements ` property: |
| * To do this, create the AMIs and create a new launch template for each AMI. | ||
| * Then, create a compatible set of instance requirements for each launch template. | ||
| * | ||
| * If you specify InstanceRequirements, you can't specify InstanceType. |
There was a problem hiding this comment.
| * If you specify InstanceRequirements, you can't specify InstanceType. | |
| * You must specify one of instanceRequirements or instanceType. |
|
Thank you for reviewing! I fixed. |
|
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). |
|
@Mergifyio update |
❌ Mergify doesn't have permission to updateDetailsFor security reasons, Mergify can't update this pull request. Try updating locally. |
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…ws#28464) Closes aws#28393 > Basically [LaunchTemplateOverrides](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.LaunchTemplateOverrides.html) for L2 construct is missing the [InstanceRequirements](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html#cfn-autoscaling-autoscalinggroup-launchtemplateoverrides-instancerequirements) attribute. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --------- Co-authored-by: Sumu Pitchayan <35242245+sumupitchayan@users.noreply.github.com>
Closes #28393
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license