def create(self, use_existing_bucket=False): """Create the bucket for the subdomain.""" #Check if the bucket name already exists in our account, #boto doesn't tell us this. connection = self.get_connection() if use_existing_bucket: bucket = connection.get_bucket(self.bucketname) else: if self.bucketname in s3_util.get_bucket_names(connection): raise Exception("Bucket '{0}' already exists in your account."\ .format(self.bucketname)) bucket = connection.create_bucket(self.bucketname) logger.info("Created new bucket : {0}".format(self.bucketname)) #A website should be publically readable: bucket.set_acl("public-read") #Turn on website functionality: if self.error_doc: bucket.configure_website(self.index, self.error_doc) else: bucket.configure_website(self.index)