How to use the regions.REGIONS.keys function in regions

To help you get started, we’ve selected a few regions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cameronmaske / skipper / skipper / aws / host.py View on Github external
def all_instances(self, **kwargs):
        """
        Returns all instances associated with the project (including stopped)
        """
        # Looks across all AWS regions, in parallel using a thread pool.
        pool = Pool(8)
        regions = kwargs.get('regions', REGIONS.keys())
        results = pool.map(self.__instances_by_region, regions)
        pool.close()
        pool.join()
        instances = []
        for result in results:
            for boto_instance in result['instances']:
                uuid = boto_instance.tags['uuid']
                instance = Instance(
                    host=self,
                    uuid=uuid,
                    project_name=self.project.name,
                    boto_instance=boto_instance,
                    size=boto_instance.instance_type,
                    region=result['region'],
                )
                instances.append(instance)
github cameronmaske / skipper / skipper / aws / instances.py View on Github external
def valid_region(self, region):
        if region in REGIONS.keys():
            self.region = region
        else:
            raise TypeError("%s is not a valid region" % self.region)