Skip to content

Instantly share code, notes, and snippets.

@seventhskye
Created August 4, 2016 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seventhskye/c818f10ba60cec77696754062cab891a to your computer and use it in GitHub Desktop.
Save seventhskye/c818f10ba60cec77696754062cab891a to your computer and use it in GitHub Desktop.
A script to detect all the instances in an autoscaling group and assign one as the master.
#!/usr/bin/env python
import sys
import boto3
def main(argv):
autoscaling = boto3.client('autoscaling')
auto_scaling_groups = autoscaling.describe_auto_scaling_groups()['AutoScalingGroups']
for asg in auto_scaling_groups:
break
if __name__ == "__main__":
main(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment