Created
December 11, 2022 22:26
-
-
Save davila7/76d17ce1438cc05d4406b9ef23857849 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #rds | |
| rds = boto3.client('rds', region_name='us-east-1') | |
| # Obtenemos una lista de todas las instancias RDS | |
| rds_instances = rds.describe_db_instances() | |
| stopRdsInstances = [] | |
| #recorremos las instancias y filtramos por tag | |
| for rds_instance in rds_instances["DBInstances"]: | |
| tags = rds.list_tags_for_resource(ResourceName=rds_instance["DBInstanceArn"]) | |
| for tag in tags["TagList"]: | |
| if tag['Key'] == 'Env': | |
| if tag['Value'] == tag_name: | |
| rds.start_db_instance(DBInstanceIdentifier=rds_instance["DBInstanceIdentifier"]) | |
| print('RDS Encendida: '+str(rds_instance["DBInstanceIdentifier"])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment