@fjall/components-infrastructure 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -151,6 +151,9 @@ export class Ec2Instance extends Construct {
151
151
  ...(props.capacityRebalance !== undefined && {
152
152
  capacityRebalance: props.capacityRebalance
153
153
  }),
154
+ ...(props.maxInstanceLifetime !== undefined && {
155
+ maxInstanceLifetime: props.maxInstanceLifetime
156
+ }),
154
157
  cooldown: Duration.seconds(60),
155
158
  groupMetrics: [GroupMetrics.all()],
156
159
  ...(resolvedUpdatePolicy !== undefined && {
@@ -165,7 +168,7 @@ export class Ec2Instance extends Construct {
165
168
  TerminationPolicy.OLDEST_LAUNCH_CONFIGURATION,
166
169
  TerminationPolicy.CLOSEST_TO_NEXT_INSTANCE_HOUR
167
170
  ],
168
- ssmSessionPermissions: true
171
+ ssmSessionPermissions: props.ssmSessionPermissions ?? true
169
172
  };
170
173
  // Support spot instances via mixed instances policy
171
174
  if (props.spotCapacityPercentage !== undefined &&
@@ -262,6 +265,22 @@ export class Ec2Instance extends Construct {
262
265
  }
263
266
  }
264
267
  function validateEc2InstanceProps(props) {
268
+ if (props.spotCapacityPercentage !== undefined) {
269
+ if (!Number.isInteger(props.spotCapacityPercentage) ||
270
+ props.spotCapacityPercentage < 0 ||
271
+ props.spotCapacityPercentage > 100) {
272
+ throw new Error(`Ec2Instance.spotCapacityPercentage must be an integer between 0 and 100; got ${props.spotCapacityPercentage}`);
273
+ }
274
+ }
275
+ if (props.minCapacity !== undefined &&
276
+ (!Number.isInteger(props.minCapacity) || props.minCapacity < 0)) {
277
+ throw new Error(`Ec2Instance.minCapacity must be a non-negative integer; got ${props.minCapacity}`);
278
+ }
279
+ if (props.maxCapacity !== undefined &&
280
+ props.minCapacity !== undefined &&
281
+ props.maxCapacity < props.minCapacity) {
282
+ throw new Error(`Ec2Instance.maxCapacity (${props.maxCapacity}) must be >= minCapacity (${props.minCapacity})`);
283
+ }
265
284
  if (props.persistentDataVolume !== undefined) {
266
285
  const azs = props.vpcSubnets?.availabilityZones;
267
286
  if (azs === undefined || azs.length !== 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/components-infrastructure",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "bin": {
@@ -67,8 +67,8 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@aws-sdk/client-organizations": "^3.1038.0",
70
- "@fjall/generator": "^3.0.0",
71
- "@fjall/util": "^3.0.0",
70
+ "@fjall/generator": "^3.1.0",
71
+ "@fjall/util": "^3.1.0",
72
72
  "constructs": "^10.6.0"
73
73
  },
74
74
  "overrides": {
@@ -82,5 +82,5 @@
82
82
  "engines": {
83
83
  "node": ">=18.0.0"
84
84
  },
85
- "gitHead": "848a386e3e2244401b76faabd02818c682d231e8"
85
+ "gitHead": "0f27cc5e260fdf218d33de546ba8610be89e1d81"
86
86
  }