找不到主机。请指定(单个)主机字符串以进行连接:

时间:2014-08-05 21:36:51

标签: python amazon-web-services amazon-s3 fabric amazon-rds

为什么我收到“没有找到主机”?以下是我的代码,如何解决?

def upload_log(self, instance_name, logfile):
    ''' Uploads an RDS log to S3 given the instance_name and the log file
    name. '''

    log = self._get_log_file(instance_name, logfile)
    key = '/'.join([instance_name, log.log_filename])
    try:
        print r'uploading logfile {} to s3://{}'.format(log.log_filename,
                                                        key)
        self._write_key(key, log.data)
        print 'uploaded logfile: {}'.format(key)
    except Exception as e:
        os.chdir("/LogFiles/")

#Getting No hosts found when it comes in except block somewhere here-->

        command1 = "rds-download-db-logfile pgd-1 --log-file-name error/{0} > {0}".format(log.log_filename)
        os.system(command1)
        command2 = "s3cmd put {} s3://rds-logproduction/pgd-1/error/".format(log.log_filename)
        os.system(command2)

我正在尝试将日志文件从RDS上传到S3。

所以,当它要求输入主机名时,我会传入“us-west-2.amazonaws.com”,之后我就会

fabric.exceptions.NetworkError: Name lookup failed for us-west-2.amazonaws.com

我错过了什么?

1 个答案:

答案 0 :(得分:0)

S3主机名应为s3.amazonaws.com