Skip to content

Try another container if starting an rds shell fails#143

Draft
snim2 wants to merge 1 commit intomainfrom
fix/try-another-container-if-rds-scripts-fail
Draft

Try another container if starting an rds shell fails#143
snim2 wants to merge 1 commit intomainfrom
fix/try-another-container-if-rds-scripts-fail

Conversation

@snim2
Copy link
Copy Markdown
Contributor

@snim2 snim2 commented Jun 28, 2023

If we do want to merge this, then a bunch of other scripts need to be changed, similarly

@rjw1
Copy link
Copy Markdown
Member

rjw1 commented Jul 14, 2023

diff --git a/bin/rds/export-dump b/bin/rds/export-dump
index 542accb..63fcc08 100755
--- a/bin/rds/export-dump
+++ b/bin/rds/export-dump
@@ -108,8 +108,9 @@ then
       --filters "Name=vpc-id,Values=$RDS_VPC" "Name=instance-state-code,Values=16" Name=tag:Name,Values="$INFRASTRUCTURE_NAME-$ENVIRONMENT*"
   )
   ECS_INSTANCE_ID=$(
+  NUMBER_OF_INSTANCES=$(echo "$ECS_INSTANCES" | jq -r .Reservations | jq length)
     echo "$ECS_INSTANCES" \
-      | jq -r .Reservations[0].Instances[0].InstanceId
+      | jq --arg i $(($RANDOM % $NUMBER_OF_INSTANCES)) -r '.Reservations[$i|tonumber].Instances[0].InstanceId'
   )
 fi

is something ive been playign with.

@DrizzlyOwl DrizzlyOwl force-pushed the fix/try-another-container-if-rds-scripts-fail branch from 92db909 to f896937 Compare September 15, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants