put-bucket-transfer-acceleration命令用於為儲存空間(Bucket)配置傳輸加速。開啟傳輸加速後,可提升全球各地使用者對OSS的訪問速度,適用於遠距離資料轉送、GB或TB級大檔案上傳和下載的情境。
注意事項
只有Bucket擁有者以及被授予oss:PutBucketTransferAcceleration許可權的RAM使用者才能發起配置傳輸加速的請求。
開啟傳輸加速後,Bucket會在保留預設Endpoint的基礎上新增傳輸加速網域名稱,但必須使用OSS的傳輸加速網域名稱才會提升訪問速度。
使用傳輸加速網域名稱訪問Bucket時,OSS會收取傳輸加速費用。詳情請參見傳輸加速費用。
關於傳輸加速的更多資訊,請參見傳輸加速。
命令格式
ossutil api put-bucket-transfer-acceleration --bucket value --transfer-acceleration-configuration value [flags]參數 | 類型 | 說明 |
--bucket | string | Bucket名稱。 |
--transfer-acceleration-configuration | string | 傳輸加速配置的容器。 |
put-bucket-transfer-acceleration命令對應API介面PutBucketTransferAcceleration。關於API中的具體參數含義,請參見PutBucketTransferAcceleration。
--transfer-acceleration-configuration
--transfer-acceleration-configuration配置選項既支援XML文法也支援JSON文法:
XML文法:
<TransferAccelerationConfiguration> <Enabled>boolean</Enabled> </TransferAccelerationConfiguration>JSON文法:
{ "Enabled": boolean }
關於支援的全域命令列選項,請參見支援的全域命令列選項。
使用樣本
為儲存空間examplebucket配置傳輸加速。
使用XML設定檔,transfer-acceleration-configuration.xml內容如下:
<?xml version="1.0" encoding="UTF-8"?> <TransferAccelerationConfiguration> <Enabled>true</Enabled> </TransferAccelerationConfiguration>ossutil api put-bucket-transfer-acceleration --bucket examplebucket --transfer-acceleration-configuration file://transfer-acceleration-configuration.xml使用JSON設定檔,transfer-acceleration-configuration.json內容如下:
{ "Enabled": "true" }ossutil api put-bucket-transfer-acceleration --bucket examplebucket --transfer-acceleration-configuration file://transfer-acceleration-configuration.json使用JSON配置參數:
ossutil api put-bucket-transfer-acceleration --bucket examplebucket --transfer-acceleration-configuration "{\"Enabled\":\"true\"}"