From 57923515ae462e74eea9e0f391770febf28c61cd Mon Sep 17 00:00:00 2001 From: Robert Massaioli Date: Fri, 4 Oct 2024 14:33:48 +1000 Subject: Update readme.md to add simple CLI option. --- readme.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/readme.md b/readme.md index 10761b7..bb8ccd1 100644 --- a/readme.md +++ b/readme.md @@ -115,6 +115,45 @@ Update your CloudFormation stack. Enter a different limit. Update your CloudFormation stack. Change the server state parameter from "Running" to "Stopped". +**How do I turn my stack on and off from the terminal?** + +You can write a bash script, using the CLI like so: + +``` bash +#!/bin/bash + +update_stack() { + local state=$1 + aws cloudformation update-stack \ + --stack-name factorio-2024 \ + --use-previous-template \ + --parameters ParameterKey=ServerState,ParameterValue=$state \ + --capabilities CAPABILITY_IAM \ + --profile AdministratorAccess-110055367801 +} + +case "$1" in + start) + update_stack "Running" + ;; + stop) + update_stack "Stopped" + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac +``` + +If you put that in a file called `update_factorio.bash` then you could run: + +``` bash +$ bash update_factorio.bash +``` + +That does require that you run `aws configure sso` first and set up an IAM account with all the right perms. + **I'm done with Factorio, how do I delete this server?** Delete the CloudFormation stack. Except for the EFS, Done. The EFS is retained when the CloudFormation stack is deleted to preserve your saves, but can then be manually deleted. -- cgit v1.2.3 From 3c3126746e0b73ba17f0d5f9fea000eea2b59aa4 Mon Sep 17 00:00:00 2001 From: Robert Massaioli Date: Fri, 4 Oct 2024 14:43:34 +1000 Subject: Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index bb8ccd1..04c4b02 100644 --- a/readme.md +++ b/readme.md @@ -129,7 +129,7 @@ update_stack() { --use-previous-template \ --parameters ParameterKey=ServerState,ParameterValue=$state \ --capabilities CAPABILITY_IAM \ - --profile AdministratorAccess-110055367801 + --profile AdministratorAccess-111111111111 } case "$1" in -- cgit v1.2.3