def get_image_id_by_name(self, ami_name, region='us-east-1'):
        """
        Locate an AMI image id by name in a particular region
        :param ami_name: ami name you need the id for
        :param region: the region the image exists in
        :return: id of the image
        """
        image_details = None
        detail_query_attempts = 0

        while image_details is None:
            describe_cmd = "aws ec2 describe-images --filters 'Name=name,Values={}' --profile '{}' --region {}"\
                .format(ami_name, self.aws_project, region)
            res = subprocess.check_output(shlex.split(describe_cmd))

            print "describe command returned: {}".format(res)

            image_details = parse_image_json(res)
            if not image_details:
                if detail_query_attempts > 5:
                    print "Tried to get image details 5 times and failed, exiting"
                    raise Exception("Unable to get AMI image id from AWS using the image name")
                time.sleep(10)
                print "No images defined returned yet, will try another query"
                detail_query_attempts += 1

        image_id = image_details['ImageId']
        print "located image id: {}".format(image_id)
        return image_id
Locate an AMI image id by name in a particular region
        :param ami_name: ami name you need the id for
        :param region: the region the image exists in
        :return: id of the image