Skip to content

feat(ec2): adding placementGroup to LaunchTemplateProps and LaunchTemplate#33726

Merged
mergify[bot] merged 3 commits intoaws:mainfrom
clayrosenthal:add-placement-group-to-lt
Mar 28, 2025
Merged

feat(ec2): adding placementGroup to LaunchTemplateProps and LaunchTemplate#33726
mergify[bot] merged 3 commits intoaws:mainfrom
clayrosenthal:add-placement-group-to-lt

Conversation

@clayrosenthal
Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #33721

Reason for this change

To allow for passing PlacementGroups to LaunchTemplates

Description of changes

Adding placementGroup to LaunchTemplateProps. I chose to only implement this part of the placement field in LaunchTemplates, not doing anything with dedicated hosts or the like, as those don't have any CDK constructs. This change enables creating a PlacementGroup and passing it to a LaunchTemplate

Describe any new or updated permissions being added

None

Description of how you validated changes

Added a unit test, ran the existing tests as well.

Checklist


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

@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK feature-request A feature should be added or improved. p2 labels Mar 10, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team March 10, 2025 21:36
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@clayrosenthal clayrosenthal changed the title feat(ec2): Adding placementGroup prop to LaunchTemplate feat(ec2): adding placementGroup to LaunchTemplateProps and LaunchTemplate Mar 11, 2025
@clayrosenthal clayrosenthal force-pushed the add-placement-group-to-lt branch from bd10ce0 to cfe1a67 Compare March 13, 2025 21:05
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 13, 2025 21:07

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@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 Mar 13, 2025
@SimonCMoore SimonCMoore added p1 and removed p2 labels Mar 27, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.38%. Comparing base (8b23b5d) to head (9fc31d8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33726   +/-   ##
=======================================
  Coverage   82.38%   82.38%           
=======================================
  Files         120      120           
  Lines        6955     6955           
  Branches     1173     1173           
=======================================
  Hits         5730     5730           
  Misses       1120     1120           
  Partials      105      105           
Flag Coverage Δ
suite.unit 82.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk ∅ <ø> (∅)
packages/aws-cdk-lib/core 82.38% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Mar 27, 2025
userData: userDataToken,
metadataOptions: this.renderMetadataOptions(props),
networkInterfaces,
placement: props.placementGroup ? {
Copy link
Copy Markdown
Contributor

@shikha372 shikha372 Mar 27, 2025

Choose a reason for hiding this comment

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

is there any correlation with the placement strategy that we can use currently for this property in CDK ??
eg. we can only use this with strategy type CLUSTER etc.

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.

What placement strategy? There's no other placement property for launch templates in CDK

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.

Thanks @clayrosenthal , seeing the difference in unit test and integration test where in unit test we have the strategy defined as

      strategy: PlacementGroupStrategy.CLUSTER,

but in integration test we used

  strategy: ec2.PlacementGroupStrategy.SPREAD,

confirming for my understanding, that we can indeed support all possible type for this while passing the placement group to launch template.

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.

It should support whatever LaunchTemplates already support

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 28, 2025

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 mergify Bot merged commit e5f71db into aws:main Mar 28, 2025
10 checks passed
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

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

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

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 28, 2025

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).

@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 28, 2025
@clayrosenthal clayrosenthal deleted the add-placement-group-to-lt branch March 28, 2025 21:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK feature-request A feature should be added or improved. p1 pr/needs-maintainer-review This PR needs a review from a Core Team Member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-ec2: Support PlacementGroup in LaunchTemplate

6 participants