Skip to content

Commit 2d30b78

Browse files
committed
Merge remote-tracking branch 'nitrocode/MaxInstanceLifetime' into keithduncan/add-asg-lifecycle
2 parents d48e9a0 + d06ab5e commit 2d30b78

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

templates/aws-stack.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,12 @@ Parameters:
437437
- "false"
438438
Default: "false"
439439

440+
MaxInstanceLifetime:
441+
Type: Number
442+
Description: The maximum amount of time, in seconds, that an instance can be in service. The default is null. If specified, the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day).
443+
Default: 0
444+
MinValue: 0
445+
440446
Rules:
441447
HasToken:
442448
Assertions:
@@ -586,6 +592,9 @@ Conditions:
586592
- !Equals [ !Select [ 0, !Split [ ".", !Ref InstanceType ] ], "r6g" ]
587593
- !Equals [ !Select [ 0, !Split [ ".", !Ref InstanceType ] ], "r6gd" ]
588594

595+
UseMaxInstanceLifetime:
596+
!Not [ !Equals [ !Ref MaxInstanceLifetime, 0 ] ]
597+
589598
Mappings:
590599
ECRManagedPolicy:
591600
none : { Policy: '' }
@@ -1072,6 +1081,7 @@ Resources:
10721081
TerminationPolicies:
10731082
- OldestLaunchConfiguration
10741083
- ClosestToNextInstanceHour
1084+
MaxInstanceLifetime: !If [UseMaxInstanceLifetime, !Ref MaxInstanceLifetime, !Ref "AWS::NoValue"]
10751085
CreationPolicy:
10761086
ResourceSignal:
10771087
Timeout: !If [ UseDefaultInstanceCreationTimeout, !If [ UseWindowsAgents, PT10M, PT5M ], !Ref InstanceCreationTimeout ]

0 commit comments

Comments
 (0)