diff options
| author | Michael Chandler <mchandler89@gmail.com> | 2020-01-07 17:51:59 +1000 |
|---|---|---|
| committer | Michael Chandler <mchandler89@gmail.com> | 2020-01-07 17:51:59 +1000 |
| commit | d108287c1757f609ee888a163840115bf237460e (patch) | |
| tree | 7381bb2cb92d3cf985d02a05fd5ce712b4ac1d6f /cf.yml | |
| parent | 11d6111dc5334bffc884be8edbae66164cbdbdc2 (diff) | |
Set ECS Service desired count (as well as ASG) when stopping / starting server.
Diffstat (limited to 'cf.yml')
| -rw-r--r-- | cf.yml | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -14,7 +14,7 @@ Parameters: ServerState:
Type: String
- Description: "Running: A spot instance will launch shortly after setting this parameter. Stopped: Your spot instance will be terminated shortly after setting this parameter."
+ Description: "Running: A spot instance will launch shortly after setting this parameter; your Factorio server should start within 5-10 minutes of changing this parameter (once UPDATE_IN_PROGRESS becomes UPDATE_COMPLETE). Stopped: Your spot instance (and thus Factorio container) will be terminated shortly after setting this parameter."
Default: Running
AllowedValues:
- Running
@@ -110,10 +110,9 @@ Conditions: Mappings:
ServerState:
Running:
- AutoScalingCapacity: 1
+ DesiredCapacity: 1
Stopped:
- AutoScalingCapacity: 0
-
+ DesiredCapacity: 0
Resources:
@@ -276,10 +275,10 @@ Resources: - MountB
Properties:
AutoScalingGroupName: !Sub "${AWS::StackName}-asg"
- DesiredCapacity: !FindInMap [ ServerState, !Ref ServerState, AutoScalingCapacity ]
+ DesiredCapacity: !FindInMap [ ServerState, !Ref ServerState, DesiredCapacity ]
LaunchConfigurationName: !Ref LaunchConfiguration
- MaxSize: !FindInMap [ ServerState, !Ref ServerState, AutoScalingCapacity ]
- MinSize: !FindInMap [ ServerState, !Ref ServerState, AutoScalingCapacity ]
+ MaxSize: !FindInMap [ ServerState, !Ref ServerState, DesiredCapacity ]
+ MinSize: !FindInMap [ ServerState, !Ref ServerState, DesiredCapacity ]
VPCZoneIdentifier:
- !Ref SubnetA
- !Ref SubnetB
@@ -322,7 +321,7 @@ Resources: Type: AWS::ECS::Service
Properties:
Cluster: !Ref EcsCluster
- DesiredCount: 1
+ DesiredCount: !FindInMap [ ServerState, !Ref ServerState, DesiredCapacity ]
ServiceName: !Sub "${AWS::StackName}-ecs-service"
TaskDefinition: !Ref EcsTask
DeploymentConfiguration:
|
