Skip to content

Commit e5f71db

Browse files
feat(ec2): adding placementGroup to LaunchTemplateProps and LaunchTemplate (#33726)
### Issue # (if applicable) Closes #33721 ### Reason for this change To allow for passing `PlacementGroup`s to `LaunchTemplate`s ### 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 - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 7c15988 commit e5f71db

File tree

11 files changed

+385
-18
lines changed

11 files changed

+385
-18
lines changed

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.assets.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.template.json

+52
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,58 @@
284284
}
285285
]
286286
}
287+
},
288+
"pg749EE6ED": {
289+
"Type": "AWS::EC2::PlacementGroup",
290+
"Properties": {
291+
"Strategy": "spread"
292+
}
293+
},
294+
"LTWithPlacementGroup4B40027C": {
295+
"Type": "AWS::EC2::LaunchTemplate",
296+
"Properties": {
297+
"LaunchTemplateData": {
298+
"Placement": {
299+
"GroupName": {
300+
"Fn::GetAtt": [
301+
"pg749EE6ED",
302+
"GroupName"
303+
]
304+
}
305+
},
306+
"TagSpecifications": [
307+
{
308+
"ResourceType": "instance",
309+
"Tags": [
310+
{
311+
"Key": "Name",
312+
"Value": "aws-cdk-ec2-lt-metadata-1/LTWithPlacementGroup"
313+
}
314+
]
315+
},
316+
{
317+
"ResourceType": "volume",
318+
"Tags": [
319+
{
320+
"Key": "Name",
321+
"Value": "aws-cdk-ec2-lt-metadata-1/LTWithPlacementGroup"
322+
}
323+
]
324+
}
325+
]
326+
},
327+
"TagSpecifications": [
328+
{
329+
"ResourceType": "launch-template",
330+
"Tags": [
331+
{
332+
"Key": "Name",
333+
"Value": "aws-cdk-ec2-lt-metadata-1/LTWithPlacementGroup"
334+
}
335+
]
336+
}
337+
]
338+
}
287339
}
288340
},
289341
"Mappings": {

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/cdk.out

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/integ.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/manifest.json

+93-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)