Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TearTheSky/5aaabb2fbf0b19c3c7a9c3bf04e65cbf to your computer and use it in GitHub Desktop.
Save TearTheSky/5aaabb2fbf0b19c3c7a9c3bf04e65cbf to your computer and use it in GitHub Desktop.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# before
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
response = aws_client.describe_db_instances(
DBInstanceIdentifier = target_rds_instance_name,
)
if response['DBInstances'][0]['MultiAZ'] == True :
response2 = aws_client.reboot_db_instance(
DBInstanceIdentifier = 'db_instance_name',
ForceFailover=True
)
else:
response2 = aws_client.reboot_db_instance(
DBInstanceIdentifier = 'db_instance_name',
ForceFailover=False
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# after
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
response = aws_client.describe_db_instances(
DBInstanceIdentifier=target_rds_instance_name,
)
response2 = aws_client.reboot_db_instance(
DBInstanceIdentifier='db_instance_name',
ForceFailover = response['DBInstances'][0]['MultiAZ']
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment