我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用boto.rds()。
def get_rds_instances_by_region(self, region): ''' Makes an AWS API call to the list of RDS instances in a particular region ''' try: conn = self.connect_to_aws(rds, region) if conn: marker = None while True: instances = conn.get_all_dbinstances(marker=marker) marker = instances.marker for instance in instances: self.add_rds_instance(instance, region) if not marker: break except boto.exception.BotoServerError as e: error = e.reason if e.error_code == 'AuthFailure': error = self.get_auth_error_message() if not e.reason == "Forbidden": error = "Looks like AWS RDS is down:\n%s" % e.message self.fail_with_error(error, 'getting RDS instances')
def get_rds_instances_by_region(self, region): ''' Makes an AWS API call to the list of RDS instances in a particular region ''' try: conn = self.connect_to_aws(rds, region) if conn: instances = conn.get_all_dbinstances() for instance in instances: self.add_rds_instance(instance, region) except boto.exception.BotoServerError as e: error = e.reason if e.error_code == 'AuthFailure': error = self.get_auth_error_message() if not e.reason == "Forbidden": error = "Looks like AWS RDS is down:\n%s" % e.message self.fail_with_error(error, 'getting RDS instances')
def aws_teardown(tags=None): '''Teardown resources on AWS Args: tags: only execute tasks matching specific tags (comma-separated) ''' ansible_playbook('aws_teardown.yml', 'localhost,',tags=tags) domain = '.glow-dev.com' local('grep {} inventory/*.yml | xargs -n1 ssh-keygen -R ' .format(domain)) rds_conn = boto.rds.connect_to_region(aws_vars['region']) for rds in aws_vars['rds_instances']: print 'RDS: {} degraded to db.t2.micro'.format(rds['name']) rds_conn.modify_dbinstance(rds['name'], instance_class='db.t2.micro', apply_immediately=True)