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

Try another container if starting an rds shell fails #143

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

snim2
Copy link
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
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