phpでS3へとアップロードする処理が突然エラーになりました。
プログラムの変更は行っておらず、昨日以前までは問題なく動作していました。
▼エラー内容
[Aws\S3\Exception\S3Exception] Error executing "PutObject" on "https://<バケット名>.s3-ap-northeast-1.amazonaws.com/<アップロードファイルパス>"; AWS HTTP error: cURL error 6: Could not resolve host: <バケット名>.s3-ap-northeast-1.amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
確認したこと
IAMユーザーの権限:AmazonS3FullAccessで問題なし
疑問点
エラー文言に記載のパスがおかしい・・・バケット名の位置がサブドメインの位置にきている。
"https://s3-ap-northeast-1.amazonaws.com/<バケット名>/<アップロードファイルパス>"
ソース
php
1 $this->config = [ 2 's3' => [ 3 'key' => '*****', 4 'secret' => '*****', 5 'bucket' => '<バケット名>', 6 ] 7 ]; 8 9 $this->s3 = S3Client::factory([ 10 'credentials' => [ 11 'key' => $this->config['s3']['key'], 12 'secret' => $this->config['s3']['secret'] 13 ], 14 'region' => 'ap-northeast-1', 15 'version' => 'latest' 16 ]); 17 18 $result = $this->s3->putObject([ 19 'Bucket' => $this->config['s3']['bucket'], 20 'Key' => $filename, 21 'SourceFile' => $file, 22 'CacheControl' => 'max-age=2592000', 23 'StorageClass' => 'REDUCED_REDUNDANCY' 24 ]); 25
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。