Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import boto3
  2.  
  3. # Config boto3
  4. region = ""
  5. aws_key_id = ""
  6. aws_secret_key = ""
  7.  
  8. # Connect AWS
  9. client_autoscaling = boto3.client('autoscaling', region_name=region, aws_access_key_id=aws_key_id, aws_secret_access_key=aws_secret_key)
  10.  
  11. class Subir_Bajar:
  12.  
  13. def __init__(self):
  14. self.info()
  15.  
  16.  
  17. def actualizar(self, autoscaling_sg, minsize, maxsize, desired):
  18. """ Actualiza la cantidad de servidores """
  19. client_autoscaling.update_auto_scaling_group(
  20. AutoScalingGroupName=autoscaling_sg,
  21. MinSize=minsize,
  22. MaxSize=maxsize,
  23. DesiredCapacity=desired
  24. )
  25.  
  26.  
  27. def info(self):
  28. """ Pide informacion para actualizar los servidores """
  29. autoscaling_sg = raw_input("Introduce el nombre del SG que quieres modificar: ")
  30. minsize = int(input("Introduce el numero minimo de instancias: "))
  31. maxsize = int(input("Introduce el numero maximo de instancias: "))
  32. desired = int(input("Introduce el numero deseado de instancias: "))
  33.  
  34. self.actualizar(autoscaling_sg, minsize, maxsize, desired)
  35.  
  36. if __name__ == "__main__":
  37. Subir_Bajar()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement