Skip to content

chore(batch): init base EC2 class for ECS and EKS#35868

Open
phuhung273 wants to merge 2 commits intoaws:mainfrom
phuhung273:batch-env
Open

chore(batch): init base EC2 class for ECS and EKS#35868
phuhung273 wants to merge 2 commits intoaws:mainfrom
phuhung273:batch-env

Conversation

@phuhung273
Copy link
Copy Markdown
Contributor

@phuhung273 phuhung273 commented Oct 28, 2025

Issue # (if applicable)

Close #35859

Reason for this change

  • Keep codebase clean
  • Prevent the case when adding a new feature to ECS but forgot to do the same for EKS
  • Streamline future change, eg: (aws-batch): AWS Batch Compute Environment For AL2023 #35839
  • A foundation to also reduce duplication for defaultInstanceClasses, useOptimalInstanceClasses, allocationStrategy, spotBidPercentage, instanceRole, launchTemplate, minvCpus, placementGroup and their related functions. I don't want to submit a huge refactor PR directly.

Description of changes

Init base EC2 class for ECS and EKS, start with only minimal things:

  • property instanceTypes
  • property instanceClasses
  • method addInstanceType
  • method addInstanceClass

Description of how you validated changes

Unit + Integ

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team October 28, 2025 04:34
@github-actions github-actions bot added p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Oct 28, 2025
@phuhung273 phuhung273 mentioned this pull request Oct 28, 2025
1 task
@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. labels Oct 30, 2025
@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 Oct 30, 2025
Copy link
Copy Markdown
Contributor

@abidhasan-aws abidhasan-aws left a comment

Choose a reason for hiding this comment

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

Hi @phuhung273 ,
Thanks for the contribution.

I just have a small nit comment.

readonly instanceTypes: ec2.InstanceType[];

/**
* The instance types that this Compute Environment can launch.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the this should be instance classes instead of instance types

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your review. I've corrected this comment

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 2, 2026
Signed-off-by: phuhung273 <phuhung.tranpham@gmail.com>
Signed-off-by: phuhung273 <phuhung.tranpham@gmail.com>
@mergify mergify bot dismissed abidhasan-aws’s stale review April 3, 2026 11:16

Pull request has been modified.

@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 Apr 3, 2026
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 effort/medium Medium work item – several days of effort 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.

batch: duplicate code in ManagedEc2EcsComputeEnvironment and ManagedEc2EksComputeEnvironment

3 participants