Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max instance lifetime #839

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions templates/aws-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,12 @@ Parameters:
- "false"
Default: "false"

MaxInstanceLifetime:
Type: Number
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).
Default: 0
MinValue: 0

Rules:
HasToken:
Assertions:
Expand Down Expand Up @@ -567,6 +573,9 @@ Conditions:
- !Equals [ !Select [ 0, !Split [ ".", !Ref InstanceType ] ], "r6g" ]
- !Equals [ !Select [ 0, !Split [ ".", !Ref InstanceType ] ], "r6gd" ]

UseMaxInstanceLifetime:
!Not [ !Equals [ !Ref MaxInstanceLifetime, 0 ] ]

Mappings:
ECRManagedPolicy:
none : { Policy: '' }
Expand Down Expand Up @@ -1044,7 +1053,9 @@ Resources:
TerminationPolicies:
- OldestLaunchConfiguration
- ClosestToNextInstanceHour
MaxInstanceLifetime: !If [UseMaxInstanceLifetime, !Ref MaxInstanceLifetime, !Ref "AWS::NoValue"]
NewInstancesProtectedFromScaleIn: true
Copy link
Contributor

Choose a reason for hiding this comment

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

@nitrocode I suspect (but haven’t tested) adding this by merging master will break the MaxInstanceLifetime functionality because none of the instances are eligible for ASG initiated termination. I’m not sure if you or anyone else are running stacks from this branch’s template but wanted to call it out in case you are 😄


CreationPolicy:
ResourceSignal:
Timeout: !If [ UseDefaultInstanceCreationTimeout, !If [ UseWindowsAgents, PT10M, PT5M ], !Ref InstanceCreationTimeout ]
Expand Down