aboutsummaryrefslogtreecommitdiffstats
path: root/cf.yml
diff options
context:
space:
mode:
authorMichael Chandler <mchandler89@gmail.com>2020-01-07 17:51:59 +1000
committerMichael Chandler <mchandler89@gmail.com>2020-01-07 17:51:59 +1000
commitd108287c1757f609ee888a163840115bf237460e (patch)
tree7381bb2cb92d3cf985d02a05fd5ce712b4ac1d6f /cf.yml
parent11d6111dc5334bffc884be8edbae66164cbdbdc2 (diff)
Set ECS Service desired count (as well as ASG) when stopping / starting server.
Diffstat (limited to 'cf.yml')
-rw-r--r--cf.yml15
1 files changed, 7 insertions, 8 deletions
diff --git a/cf.yml b/cf.yml
index 66a4882..8530e33 100644
--- a/cf.yml
+++ b/cf.yml
@@ -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:
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage