本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
啟用和使用 S3 Transfer Acceleration
您可以使用 Amazon S3 Transfer Acceleration,在用戶端與 S3 儲存貯體之間長距離快速安全地傳輸檔案。您可以使用 S3 主控台、 AWS Command Line Interface (AWS CLI)、API 或 AWS SDK 啟用傳輸加速。
本節示範如何在儲存貯體上啟用 Amazon S3 Transfer Acceleration,以及使用已啟用儲存貯體的加速端點。
如需 Transfer Acceleratio 要求的更多資訊,請參閱「使用 Amazon S3 Transfer Acceleration 設定快速安全的檔案傳輸」。
注意
如果您想要比較加速和非加速的上傳速度,請開啟 Amazon S3 Transfer Acceleration 速度比較工具
速度比較工具使用分段上傳功能,將檔案從瀏覽器傳輸到不使 AWS 區域 用 Amazon S3 傳輸加速的各種檔案。您可以依區域比較直接上傳和傳輸加速上傳的上傳速度。
啟用 S3 儲存貯體的 Transfer Acceleration
登入 AWS Management Console 並開啟 Amazon S3 主控台,網址為 https://console.aws.amazon.com/s3/
。 -
在 Bucket (儲存貯體) 清單中,選擇您要啟用 Transfer Acceleration 的儲存貯體名稱。
-
選擇 Properties (屬性)。
-
在轉換加速下,選擇編輯。
-
依序選擇 Enable (啟用) 和 Save changes (儲存變更)。
實現資料傳輸加速
-
在 Amazon S3 為儲存貯體啟用 Transfer Acceleration 後,請檢視儲存貯體的 Properties (屬性) 索引標籤。
-
在傳輸加速下,加速端點會顯示儲存貯體的傳輸加速端點。使用此端點以實現進出儲存貯體的資料傳輸加速。
若暫停傳輸加速,則加速端點將不會再運作。
以下是用於傳輸加速的 AWS CLI 指令範例。如需設定的指示 AWS CLI,請參閱使用 AWS CLI 來透過 Amazon S3 進行開發。
在儲存貯體上啟用 Transfer Acceleration
使用指 AWS CLI put-bucket-accelerate-configuration令可在值區上啟用或暫停傳輸加速。
下列範例設定 Status=Enabled
,在儲存貯體上啟用 Transfer Acceleration。您可以使用 Status=Suspended
暫停 Transfer Acceleration。
$
aws s3api put-bucket-accelerate-configuration --bucketbucketname
--accelerate-configuration Status=Enabled
使用 Transfer Acceleration
您可以將 s3 和 s3api AWS CLI 命令發出的所有 Amazon S3 請求導向到加速端點:。s3-accelerate.amazonaws.com
若要這麼做,請在 AWS Config 檔案true
中use_accelerate_endpoint
的設定檔中將組態值設定為。必須在儲存貯體上啟用 Transfer Acceleration,才能使用加速端點。
所有請求都是使用虛擬樣式的儲存貯體定址所傳送:my-bucket.s3-accelerate.amazonaws.com
。不會將任何 ListBuckets
、CreateBucket
和 DeleteBucket
請求傳送至加速端點,因為該端點不支援這些操作。
如需有關 use_accelerate_endpoint
的詳細資訊,請參閱 AWS CLI 命令參考中的 AWS CLI S3 組態。
下列範例會將預設描述檔中的 use_accelerate_endpoint
設為 true
。
$
aws configure set default.s3.use_accelerate_endpoint true
如果您想要將加速端點用於某些 AWS CLI 命令,但不想使用其他命令,則可以使用下列兩種方法之一:
-
透過將
--endpoint-url
參數設定為https://s3-accelerate.amazonaws.com
,使用任何 s3 或 s3api 命令加速端點。 -
在您的 Config 文件中設置單獨的 AWS 配置文件。例如,您可以建立一個設定檔,將
use_accelerate_endpoint
設為true
,再建立另一個設定檔不設定use_accelerate_endpoint
。當您執行命令時,根據是否要使用加速端點來指定要使用的描述檔。
將物件上傳至已啟用 Transfer Acceleration 的儲存貯體
下列範例使用已設定成使用加速端點的預設描述檔,以將檔案上傳至已啟用 Transfer Acceleration 的儲存貯體。
$
aws s3 cpfile.txt
s3://bucketname/keyname
--regionregion
下列範例使用 --endpoint-url
參數指定加速端點,以將檔案上傳至已啟用 Transfer Acceleration 的儲存貯體。
$
aws configure set s3.addressing_style virtual$
aws s3 cpfile.txt
s3://bucketname/keyname
--regionregion
--endpoint-url https://s3-accelerate.amazonaws.com
以下是使用「傳輸加速」使用 AWS 開發套件將物件上傳到 Amazon S3 的範例。某些 AWS SDK 支援的語言 (例如 Java 和 .NET) 會使用加速端點用戶端設定旗標,因此您不需要將傳輸加速的端點明確設定為儲存格名稱 .s3 -加速 .amazonaws.com。
使用 REST API PutBucketAccelerateConfiguration
操作,以在現有儲存貯體上啟用加速設定。
如需詳細資訊,請參閱《Amazon Simple Storage Service API 參考》中的 PutBucketAccelerateConfiguration。