def setup_sdb_domain(domain_name="mqlib-domain"): sdb = boto.sdb.connect_to_region(AWS_REGION) # Only create if it doesn't exist already try: dom = sdb.get_domain(domain_name, validate=True) except: # Doesn't exist yet dom = sdb.create_domain(domain_name) return sdb, dom
def setup_sdb_domain(domain_name="mqlib-domain"): sdb = boto.sdb.connect_to_region(AWS_REGION) # Only create if it doesn't exist already try: dom = sdb.get_domain(domain_name,validate=True) except: # Doesn't exist yet dom = sdb.create_domain(domain_name) return sdb, dom
def create_db(domain_name, region_name): """Create a new DB :param domain: Name of the domain to create :type domain: str """ sdb = boto.sdb.connect_to_region(region_name) check_valid_region(sdb, region_name) return sdb.create_domain(domain_name)
def get_domain(self, name, auto_create=False): """Get a domain in the simpledb service""" sdb = self.get_sdb() try: dom = sdb.get_domain(name) except boto.exception.SDBResponseError: if auto_create: dom = sdb.create_domain(name) else: raise return dom
def __init__(self, profile_name, profile): Archiver.__init__(self, profile_name, profile) sdb = boto.sdb.connect_to_region( profile['aws-region'], aws_access_key_id=profile['aws-access-key-id'], aws_secret_access_key=profile['aws-secret-access-key']) self._domain = sdb.create_domain(profile['aws-namespace']) glacier = boto.glacier.connect_to_region( profile['aws-region'], aws_access_key_id=profile['aws-access-key-id'], aws_secret_access_key=profile['aws-secret-access-key']) self._vault = glacier.create_vault(profile['aws-namespace']) self._storage_cost = profile.get('aws-storage-cost', 0.01)
from pprint import pprint appId = "{{ priam_clustername }}" def put_record(domain, prop, val): print "Inserting into %s: %s -> %s" % (domain, prop, val) itemname = "%s.%s" % (appId, prop) sdb.put_attributes(domain, itemname, {"appId" : appId, "property" : prop, "value" : val}) return sdb = boto.sdb.connect_to_region("us-east-1") ii = sdb.lookup("InstanceIdentity", validate=True) if ii is None: print "No InstanceIdentity, creating." ii = sdb.create_domain("InstanceIdentity") pp = sdb.lookup("PriamProperties", validate=True) if pp is None: print "No PriamProperties, creating." pp = sdb.create_domain("PriamProperties") put_record("PriamProperties", "priam.s3.bucket", "{{ priam_s3_bucket }}") put_record("PriamProperties", "priam.s3.base_dir", "{{ priam_s3_base_dir }}") put_record("PriamProperties", "priam.clustername", "{{ priam_clustername }}") put_record("PriamProperties", "priam.data.location", "{{ cassandra_data_location }}") put_record("PriamProperties", "priam.cache.location", "{{ cassandra_cache_location }}") put_record("PriamProperties", "priam.commitlog.location", "{{ cassandra_commitlog_location }}") put_record("PriamProperties", "priam.cass.home", "{{ cassandra_home }}") put_record("PriamProperties", "priam.cass.startscript", "{{ priam_cass_startscript }}") put_record("PriamProperties", "priam.cass.stopscript", "{{ priam_cass_stopscript }}")
""" % { 'userid': user_name, 'accesskey': access_key, 'secretkey': secret_key } # 3) Check if SimpleDB domain exist, if not, create. try: domain = sdb.get_domain(domain_name, True) print "INITIALIZE: Domain %s already exists, " \ "not touching it" % (domain_name,) except SDBResponseError, err: if err.error_code != 'NoSuchDomain': raise err print "INITIALIZE: Domain %s does not exist, creating it" % ( domain_name,) domain = sdb.create_domain(domain_name) # 4) Check if security group exist, if not, create. if sg_exists: print "INITIALIZE: Security group %s already exists, " \ "not touching it" % (sg_name,) else: print "INITIALIZE: Security group %s does not exist, " \ "creating it" % (sg_name,) conn.create_security_group(sg_name, 'Created by Can Opener') # Done! Skip to next. continue try: domain = sdb.get_domain(domain_name, True)
#!/usr/bin/python import boto.sdb sdb = boto.sdb.connect_to_region("us-east-1") ii = sdb.lookup("InstanceIdentity", validate=True) if ii is not None: print "Dropping InstanceIdentity." sdb.delete_domain('InstanceIdentity') ii = sdb.create_domain("InstanceIdentity")
</style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAzc0NxoydaK4dD-Gz-bJhXtsIqXvbgvoQ&sensor=true"> </script> <script type="text/javascript"> function initialize() { var mapOptions = { center: new google.maps.LatLng(39.8282, -95.5795), zoom: 4, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); """ sdb = boto.sdb.connect_to_region(FLAGS.region) domain = sdb.create_domain(FLAGS.domain) query = 'select * from `' + FLAGS.domain + "` where tree is not null and datetaken like '" + argv[0] + "%'" for message in domain.select(query): try: if not message.get('tree') or not message.get('url_z'): continue message['latitude'] = float(message['latitude']) message['longitude'] = float(message['longitude']) message['avghue'] = int(message['treehue']) if message['latitude'] == 0 and message['longitude'] == 0: continue print """ marker = new google.maps.Marker({ position: new google.maps.LatLng(%(latitude)f, %(longitude)f),