AWSS3에서 오류 파일을 업로드하려고하는데 "액세스하려는 버킷을 지정된 끝점을 사용하여 해결해야합니다. 앞으로 모든 요청을 이 끝점 : "test9011960909.s3.amazonaws.com". "메인 버킷의 하위 폴더에 파일을 업로드 할 수 없습니다.
'region'=> 'us-east-1'도 지정했지만 여전히 같은 오류가 발생합니다.
을 내가
'Bucket' => $this->bucket,
을 지정할 때이 작동하지만 난 주요 버킷의 하위 폴더에 파일을 업로드하고 싶었
'Bucket' => $this->bucket . "/" . $PrefixFolderPath,
난 이미 여전히 AWS S3: The bucket you are attempting to access must be addressed using the specified endpoint
만에서 승인 된 대답을 적용 동일한 오류가 발생하면, 나는 PHP를 사용하고있다
코드 :
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
class AWSS3Factory {
private $bucket;
private $keyname;
public function __construct() {
$this->bucket = AWSS3_BucketName;
$this->keyname = AWSS3_AccessKey;
// Instantiate the client.
}
public function UploadFile($FullFilePath,$PrefixFolderPath="") {
try {
$s3 = S3Client::factory(array(
'credentials' => array(
'key' => MYKEY,
'secret' => MYSECKEY,
'region' => 'eu-west-1',
)
));
// Upload data.
$result = $s3->putObject(array(
'Bucket' => $this->bucket . "/" . $PrefixFolderPath,
'Key' => $this->keyname,
'SourceFile' => $FullFilePath,
'StorageClass' => 'REDUCED_REDUNDANCY'
));
return true;
// Print the URL to the object.
//echo $result['ObjectURL'] . "\n";
} catch (S3Exception $e) {
echo $e->getMessage() . "\n";
}
}
}
가능한 중복 : 액세스하려는 버킷은 지정된 끝점을 사용하여 주소를 지정해야합니다.] (http://stackoverflow.com/questions/25027462/aws-s3-the-bucket-you-are-attempting-to-access-must-be- 주소 지정 - 사용 - - 사양) –
나는 이미 승인 된 답변을 적용했지만 여전히이 질문을 게시하는 이유는 동일한 오류가 발생, 나는 PHP를 사용하고 있습니다. –
이 오류에 대한 AWS의 유일한 설명은 다음과 같습니다. http://docs.aws.amazon.com/redshift/latest/dg/s3serviceexception-error.html#bucket-in-different-region 그리고 이것이 유일한 시간입니다. 나 자신 (그리고 다른 사람들의 대부분)이 그것을 보았고, 나는 다른 이유를 생각할 수 없다. 올바른 지역에서 액세스하고 있다고 생각되면 AWS 콘솔을 확인하고 AWS로 티켓을 발행하십시오. –