docs: def Run(self):
      """ Build the Amazon Machine Image. """
      template_instance = None
      res = self.ec2.get_all_instances( \
              filters={'tag-key': 'spec', 
                       'tag-value' : self.ami_spec.ami_name,
                       'instance-state-name' : 'running'})    
      if res:
        running_template_instances = res[0].instances
        if running_template_instances:
          assert(len(running_template_instances) == 1)
          template_instance = running_template_instances[0]    
      # if there is not a currently running template instance, start one
      if not template_instance:
        template_instance = self.__CreateTemplateInstance()
        template_instance.add_tag('spec', self.ami_spec.ami_name)
      assert(template_instance)  
      if self.ami_spec.role == 'workstation':
        self.__ConfigureAsWorkstation(template_instance)
      elif self.ami_spec.role == 'master':
        self.__ConfigureAsClusterMaster(template_instance)
      elif self.ami_spec.role == 'worker':
        self.__ConfigureAsClusterWorker(template_instance)
      else: 
        raise RuntimeError('unknown role: %s' % (self.ami_spec.role))        
      
      
      
      print 'Please login and perform any custom manipulations before '\
            'snapshot is made!'
      
      raw_input('Press any key to shutdown and begin creating AMI. '\
                '(or ctrl-c to quit and re-run config process).')
      
      self.__SecurityScrub(template_instance)
      
      ami_id = None
      if self.ami_spec.root_store_type == 'ebs':  
        ami_id = self.__CreateEbsAmi(template_instance)
      else:
        logging.info('Support for creating instance-store backed images has been'
                     ' disabled in this version because it required much greater'
                     ' complexity.')
        ami_id = self.__CreateEbsAmi(template_instance)
      
      logging.info('ami id: %s' % (ami_id))
      # TODO(heathkh): implement these features...
      
      #self.__SetImagePermissions(ami_id)
      #self.__DistributeImageToAllRegions(ami_id)
        
      print 'terminating template instance'
      self.ec2.terminate_instances(instance_ids=[template_instance.id])
      core.WaitForInstanceTerminated(template_instance)    
      return