No part of this document may be reproduced or transmitted in any form or by any means without prior
written consent of Huawei Technologies Co., Ltd.
Trademarks and Permissions
and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their respective
holders.
Notice
The purchased products, services and features are stipulated by the contract made between Huawei and
the customer. All or part of the products, services and features described in this document may not be
within the purchase scope or the usage scope. Unless otherwise specied in the contract, all statements,
information, and recommendations in this document are provided "AS IS" without warranties, guarantees
or representations of any kind, either express or implied.
The information in this document is subject to change without notice. Every eort has been made in the
preparation of this document to ensure accuracy of the contents, but all statements, information, and
recommendations in this document do not constitute a warranty of any kind, express or implied.
3.1 Preparing the Environment..................................................................................................................................................6
4.1 Creating a Bucket..................................................................................................................................................................12
4.5 Deleting a Bucket..................................................................................................................................................................21
4.6 Conguring a Bucket Policy.............................................................................................................................................. 22
4.7 Obtaining a Bucket Policy..................................................................................................................................................23
4.8 Deleting a Bucket Policy.....................................................................................................................................................24
5.1 Creating a Folder...................................................................................................................................................................26
5.2 Uploading an Object............................................................................................................................................................28
5.6 Copying an Object................................................................................................................................................................ 49
5.7 Moving an Object................................................................................................................................................................. 59
5.8 Downloading an Object......................................................................................................................................................68
5.9 Generating the Download Link of an Object..............................................................................................................79
5.10 Deleting an Object............................................................................................................................................................. 83
5.19 Deleting a Multipart Upload Task..............................................................................................................................141
5.20 Creating an Authorization Code for Directory Sharing.......................................................................................144
5.21 Listing Objects by Using an Authorization Code.................................................................................................. 146
5.22 Downloading Objects by Using an Authorization Code..................................................................................... 149
6.2 Deleting Part Records....................................................................................................................................................... 160
6.3 Viewing Command Help Information......................................................................................................................... 162
6.4 Querying the Version Number.......................................................................................................................................164
6.6 Checking and Updating the Version............................................................................................................................ 166
6.7 Listing Failure Result Files............................................................................................................................................... 167
7.9 Deleting All Multipart Upload Tasks in a Bucket.................................................................................................... 177
8.3 Result Lists............................................................................................................................................................................ 179
9.6 Using obsutil for Resumable Data Transfer...............................................................................................................189
9.7 Using obsutil to Upload a Symbolic Link................................................................................................................... 190
Conguring an HTTP Proxy for obsutil.......................................................................................................................190
9.8
9.9 Using obsutil to Share Directories................................................................................................................................ 191
9.10 Using obsutil to Replicate Data Across Regions on the Client Side............................................................... 192
A Parameter Description.......................................................................................................193
Object Storage Service
Tool Guide (obsutil)1 Introduction to obsutil
1 Introduction to obsutil
obsutil is a command line tool for accessing and managing OBS on HUAWEI
CLOUD. You can use this tool to perform common
creating buckets, uploading and downloading les/folders, and deleting les/folders. If you are familiar with command line interface (CLI), obsutil is
recommended for batch processing and automated tasks.
congurations on OBS, such as
obsutil is compatible with the Windows, Linux, and macOS operating systems
(OSs). Table 1-1 lists the recommended OS versions. To obtain the obsutil
download links and methods for
Table 1-1 Recommended OS versions for using obsutil
OS
Windows● Windows 7
Linux● SUSE 11
macOSmacOS 10.13.4
Tool Advantages
dierent OSs, refer to Downloading obsutil.
Recommended Version
● Windows 8
● Windows 10
● Windows Server 2016
● EulerOS 2
● CentOS 7
obsutil features the following advantages:
1.Simple and easy to use
2.Lightweight and installation-free
3.Compatible with Windows, Linux, and macOS operating systems
Diversiedcongurations and excellent performance
Object Storage Service
Tool Guide (obsutil)1 Introduction to obsutil
Application Scenarios
●Automated backup and archiving, for example, periodically uploading local
data to OBS.
●Scenarios that cannot be implemented using other tools such as OBS Browser
+, for example, synchronously uploading, downloading, and copying objects.
Functions
Table 1-2 lists obsutil functions.
Table 1-2 obsutil functions
FunctionDescription
Basic operations on
buckets
Basic operations on
objects
LoggingAllows you to congure logging on the client side to
Create buckets of dierent storage classes in specic
regions, delete buckets, and obtain the bucket list and
conguration information.
Manage objects, including uploading, downloading,
deleting, and listing objects. Supported operations are
detailed as follows:
● Upload one or more les or folders.
● Upload large les in multiple parts.
● Synchronously upload, download, and copy
incremental objects.
● Copy a single object or copy multiple objects in
batches by object name
● Move a single object or move objects in batches by
object name
● Resume failed upload, download, or copy tasks.
record operations on buckets and objects for statistics
analysis later.
prex.
prex.
Advanced bucket and object management operations are being developed
continuously, and will be available in later versions of obsutil. You can also go to
OBS Console and explore more. For details, see OBS Console Operation Guide.
Command Line Structure
The obsutil command line structures are as follows:
Object Storage Service
Tool Guide (obsutil)1 Introduction to obsutil
● command indicates the command to be executed, for example, ls or cp.
● parameters indicates the basic parameters (mandatory) of the command, for example,
bucket name when creating a bucket.
● options indicates the additional parameters (optional) of the command. Additional
parameters must be preceded with a hyphen (-) when you run the command.
● The square brackets ([]) are not part of the command. Do not enclose parameter values
with them when entering a command.
● If the command contains special characters including ampersands (&), angle brackets
(<) and (>), and spaces, they need to be escaped using quotation marks. Use single
quotation marks for Linux or macOS and quotation marks for Windows.
● Additional parameters can be input in the -
-acl=private, or -acl private. There is no dierence between the two formats. Select
either one as you like.
● In Windows, you can directly execute obsutil.exe to enter an interactive command
mode. In this mode, you can input
command [parameters...] [options...]
to run a command. An example is provided as follows:
Enter "exit" or "quit" to logout
Enter "help" or "help command" to show help docs
Input your command:
-->ls -limit=3 -s
obs://bucket-001
obs://bucket-002
obs://bucket-003
Bucket number is: 3
key=value
or -
key value
format, for example,
without obsutil
Input your command:
-->
● If you use SSH to remotely log in to the Linux or macOS for running obsutil commands,
you are advised to set TMOUT=0 to prevent the program from exiting due to the
expiration of the SSH session.
Object Storage Service
Tool Guide (obsutil)2 Download and Installation
2 Download and Installation
Download Links
Table 2-1 lists the download links of obsutil for
Table 2-1 Download links of obsutil
Operatin
g System
Windows
(64-bit)
Linux
AMD
(64-bit)
Linux
ARM
(64-bit)
macOS
(64-bit)
Download LinkHow to UseView Help
obsutil_windows64
obsutil_windows64_sha256
obsutil_linux_amd64
obsutil_linux_amd64_sha256
obsutil_linux_arm64
obsutil_linux_arm64_sha256
obsutil_mac64
obsutil_mac64_sha256
dierent operating systems.
After the download
is complete, click
here to see how to
quickly get started
with obsutil.
Basic functions
● Listing Buckets
● Uploading an
Object
● Listing Objects
You can also
click here to
learn how
to use the
help
command
to get
familiar
with more
functions of
obsutil.
For details about the version revision records of obsutil, see ChangeLog.
Quick Installation
Methods of downloading obsutil vary according to dierent operating systems.
obsutil is an installation-free tool and can be used after the package is
downloaded and decompressed.
●In Windows
a.Directly download the obsutil package to your local PC using the
Object Storage Service
Tool Guide (obsutil)2 Download and Installation
b.After the download completes, decompress the package to a specied
folder.
c.Double-click obsutil.exe in the decompressed folder and then you can
use the tool.
Alternatively, you can open the CLI to go to the upper-level directory of
obsutil.exe and run obsutil commands. The command line structures of the two
modes are dierent. For details, see Command Line Structure.
●In Linux
a.Open the CLI and run the wget command to download the obsutil tool
You can also download the obsutil package from a PC running the Windows
operating system and then use a cross-platform transfer tool (such as WinSCP) to
transfer the package to your host running the Linux operating system.
b.Run the following command in the directory where the tool package
resides:
tar -xzvf obsutil_linux_amd64.tar.gz
c.Go to the directory where obsutil resides and run the following command
to grant the execute permission to obsutil:
chmod 755 obsutil
●macOS
a.Directly download the obsutil package to your local PC using the
corresponding download link.
b.After the download completes, decompress the package to a
specied
folder.
c.Open the CLI, go to the directory where obsutil resides, and run the
following command to grant the execute permission to obsutil:
chmod 755 obsutil
If you need to use obsutil on a HUAWEI CLOUD ECS, see the reference section below to
congure access to OBS over intranet to save trac costs.
● Accessing OBS over Intranet by Using obsutil on a Linux ECS
Object Storage Service
Tool Guide (obsutil)3 Getting Started
3 Getting Started
3.1 Preparing the Environment
To use obsutil, you need to register a cloud service account, enable OBS, and
obtain the access keys (AK and SK)
rst.
Step 1 Register a cloud service account.
Before using OBS, ensure that you have a cloud service account.
1.Open a browser.
2.Log in to the HUAWEI CLOUD website at huaweicloud.com/intl/en-us/.
3.In the upper right corner of the page, click Register.
4.Enter the registration information and click Register.
Step 2 Enable OBS.
Ensure that your account balance is
1.Log in to OBS Console.
2.Click Fees in the upper right corner of the page. The Billing Center page is
displayed.
3.Then click Top Up.
4.Top up the account as prompted.
5.Go back to the management console page after the recharging is successful.
6.Click Service List on the top menu bar. Choose Storage > Object Storage
Service to log in to OBS Console.
Step 3 (Optional) Create an IAM user.
sucient before using OBS.
For data security, it is recommended that you do not use the account directly to
access OBS. Through the Identity and Access Management (IAM) service, you can
create a user who has the permission to access OBS resources and manage
buckets and objects on obsutil. If you do not need to use any IAM user, skip this
step.
1.On the top navigation bar of the console, choose Service List > Management& Deployment > Identity and Access Management.
Object Storage Service
Tool Guide (obsutil)3 Getting Started
2.On the displayed IAM console page, create a user group with OBS permissions
congured.
For details, see Creating a User Group. After the user group is created, locate
the row that displays Global service > OBS in the User Group Permissions,
and click Congure Policy in the row to set OBS permissions for the user
group.
For details about OBS policies, see Permissions Management
3.Create a user.
For details, see Creating a User. When creating a user, set the User Group to
the one created in Step 3.2 with OBS permissions congured.
If the user group is not congured with OBS permissions, you can congurene-grain
permissions on OBS Console through bucket policies or object policies. For details, see
Permission Control.
Step 4 Obtain access keys.
OBS uses AKs and SKs in user accounts for signature verication to ensure that
only authorized accounts can access
specied OBS resources. Detailed
explanations about AK and SK are as follows:
●Access key ID (AK): indicates the ID of the access key, which is a unique
identier used together with a secret access key to sign requests
cryptographically.
●Secret access key (SK): indicates the private key used together with its
associated AK to cryptographically sign requests. The AK and SK are used
together to identify a request sender to prevent the request from being
modied.
A user can create a maximum of two valid access keys.
Create access keys as follows:
1.In the upper right corner of the console page, select My Credential under the
username.
2.On the My Credentials page, select Access Keys in the navigation pane on
the left.
3.On the Access Keys page, click Add Access Key.
A user can create a maximum of two valid access keys.
4.In the Add Access Key dialog box that is displayed, enter the password and
verication code.
its
– If you have not bound an email address or mobile number, enter only the
password.
– If you have bound an email address and a mobile number, you can select the
Object Storage Service
Tool Guide (obsutil)3 Getting Started
5.Click OK.
6.In the Download Access Key dialog box that is displayed, click OK to save the
access keys to your browser's default download path.
Keep the access keys properly to prevent information leakage. If you click Cancel in
the dialog box, the access keys will not be downloaded, and you cannot download
them later. Re-create access keys if required.
7.Open the downloaded credentials.csvle to obtain the access keys (AK and
SK).
In the access key le, the value in the Access Key ID column is the AK, and the value
in the Secret Access Key column is the SK.
----End
3.2 Performing Initial Conguration
Before using obsutil, you need to congure the interconnection between obsutil
and OBS, including the endpoint and access keys (AK and SK) of OBS. You can use
obsutil to perform operations on OBS buckets and objects only after obtaining the
OBS authentication.
Prerequisites
●You have downloaded the software package of obsutil. For details, see
Download and Installation.
●You have obtained the enabled regions and endpoints of OBS. For details, see
Regions and Endpoints. If you want to access OBS in the AP-Hong Kong
region, the actual OBS service address is: https://obs.apsoutheast-3.myhuaweicloud.com.
●You have obtained the access keys (AK and SK). For details about how to
obtain access keys, see Preparing the Environment. Click here to open the
access key management page.
Conguration Method
Method 1: Run the
cong command, see Updating a Conguration File. The following is an
example:
cong command to initialize obsutil. For details about the
Object Storage Service
Tool Guide (obsutil)3 Getting Started
● After running the preceding commands, a congurationle.obsutilcong is
automatically generated in the same home directory of the user who executes obsutil
commands (the ~ directory in Linux or macOS, and the C:\Users\
in Windows).
● For details about the parameters in the .obsutilcongle, see Parameter Description.
● The .obsutilcongle contains the AK and SK information of a user. Therefore, it is
hidden by default to prevent key disclosure. To query the le, run the following
command in the home directory of the user who executes obsutil commands.
●In Windows
dir
●In Linux or macOS
ls -a
or
ls -al
● obsutil encrypts the AK and SK in the
● Note: You can use the -i, -k, and -e options to
authentication. You can run the history command in the Linux OS to query the
parameter values. Exercise caution when performing this operation.
.obsutilcong contains all the conguration information of obsutil.
.obsutilcong le to ensure key security.
congure user information for
<Username>
directory
Method 2: You can use Conguring Auto Obtaining of Access Keys for obsutil
to implement initial
Checking the Connectivity
After the
the following commands:
●In Windows
●In Linux or macOS
Check the conguration result based on the command output:
●If the command output contains Bucket number is:, the conguration is
●If the command output contains Http status [403], the access keys are
●If the command output contains A connection attempt failed, then OBS
conguration is complete, you can check whether it is correct by running
obsutil ls -s
./obsutil ls -s
correct.
incorrectly congured.
cannot be accessed. In this case, check the network condition.
conguration.
If the command output contains Http status [403], you may not have the required
permissions for obtaining the bucket list. In this case, further locate the root cause based on
the specic situation.
3.3 Quick Start
This section uses the Linux OS as an example to describe how to use obsutil to
perform basic data operations in OBS. For details, see Figure 3-1.
In the preceding command, parameter location indicates the region where a bucket is
created. It is mandatory only when the endpoint set during initial conguration belongs to
any other regions than the default one CN North-Beijing1 (cn-north-1). Click here to query
currently valid regions.
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
4 Bucket Commands
4.1 Creating a Bucket
Function
You can use this command to create a bucket. A bucket name must be unique in
OBS. One account can create a maximum of 100 buckets.
If you create a bucket and name it the same as an existing one in the same account and
region, no error will be reported and status code 200 is returned. The bucket properties
comply with those set in the rst creation request. In other cases, creating a bucket with
the same name as an existing one will receive the status code 409, indicating that the
bucket already exists.
If the congured endpoint is a global domain name, you may need to wait several
minutes before uploading objects to the created bucket. Therefore, set the
endpoint to a regional domain name according to Performing Initial
Conguration if you want to upload objects instantly to the bucket.
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
obsutil mb obs://bucket-test
Create bucket [bucket-test] successfully, request id [0000016979E1D2EA860BB5E80A6B8FCC]
●Take the Windows OS as an example. Run the obsutil mb obs://bucket001
command to create a namesake bucket. The creation fails.
obsutil mb obs://bucket001
Create bucket [bucket001] failed, http status [409], error code [BucketAlreadyExists], error message
[The requested bucket name is not available. The bucket namespace is shared by all users of the
system. Please select a
[04030000016757F31A0333281A6B1E92]
dierent name andtry again.], request id
Parameter Description
Parame
ter
Optional or
Mandatory
Description
bucketMandatoryBucket name
NOTE
A bucket name must comply with the following rules:
● Contains 3 to 63 characters, including lowercase
letters, digits, hyphens (-), and periods (.), and starts
with a digit or letter.
● Cannot be an IP address.
● Cannot start or end with a hyphen (-) or period (.).
● Cannot contain two consecutive periods (.), for
example, my..bucket.
● Cannot contain periods (.) and hyphens (-) adjacent
to each other, for example, my-.bucket or my.-bucket.
aclOptional
(additional
parameter)
Access control policies that can be specied when
creating a bucket. Possible values are:
● private
● public-read
● public-read-write
NOTE
The preceding three values indicate private read and
write, public read, and public read and write.
scOptional
(additional
parameter)
Default bucket storage class that can be specied
when creating a bucket. Possible values are:
● standard: OBS Standard, which features low
access latency and high throughput, and is
applicable to storing frequently accessed data
(multiple accesses per month) or data that is
smaller than 1 MB
● warm: OBS Infrequent Access. It is applicable to
storing infrequently accessed (less than 12 times
a year) data that requires quick response.
● cold: OBS Archive. It is secure, durable, and
inexpensive, and applicable to archiving rarelyaccessed (once a year) data.
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
Parame
ter
Optional or
Mandatory
locationMandatory
unless the
region where
the OBS service
resides is not
the default
region
(additional
parameter)
congOptional
(additional
parameter)
eOptional
(additional
parameter)
iOptional
(additional
parameter)
Description
Region where the bucket resides.
NOTE
This parameter indicates the region where a bucket will
be created. It is mandatory only when the endpoint
belongs to any other regions than the default one CN
North-Beijing1 (cn-north-1). Click here to query currently
valid regions.
User-denedcongurationle for executing a
command. For details about parameters that can
be congured, see Parameter Description.
Species the endpoint.
Species the user's AK.
kOptional
(additional
parameter)
tOptional
(additional
parameter)
4.2 Listing Buckets
Function
You can use this command to obtain the bucket list. In the list, bucket names are
displayed in lexicographical order.
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
Bucket CreationDate Location BucketType
obs://bucket001 2018-09-03T01:53:02Z example OBJECT
obs://bucket002 2018-11-01T01:40:01Z example OBJECT
obs://bucket003 2018-10-25T11:45:45Z example OBJECT
obs://bucket004 2018-10-26T02:33:09Z example OBJECT
obs://bucket005 2018-10-26T02:34:50Z example OBJECT
Bucket number is: 5
Parameter Description
ParameterOptional or MandatoryDescription
sOptional (additional
parameter)
scOptional (additional
parameter)
jOptional (additional
parameter). It must be
used together with sc.
limitOptional (additional
parameter)
congOptional (additional
parameter)
Displays simplied query result.
NOTE
In the simplied format, the returned
result contains only the bucket name.
Queries the storage classes of the
buckets when listing buckets.
Indicates the maximum number of
concurrent tasks for querying the
bucket storage class. The default
value is the value of defaultJobs in
the congurationle.
NOTE
The value is ensured to be greater than or
equal to 1.
Maximum number of buckets that
can be queried. If the value is less
than 0, all buckets are listed. If it is
left blank, a maximum of 1000
buckets can be listed by default.
User-denedcongurationle for
executing a command. For details
about parameters that can be
congured, see Parameter
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
In the bucket listing result, the BucketType eld indicates the bucket type; OBJECT
indicates the bucket for object storage.
4.3 Querying Bucket Properties
Function
You can use this command to query the basic properties of a bucket, including its
default storage class, region, version ID, storage usage, bucket quota, and the
number of objects in the bucket.
Command Line Structure
●In Windows
obsutil stat obs://bucket [-acl] [-bf=xxx] [-cong=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
●In Linux or macOS
./obsutil stat obs://bucket [-acl] [-bf=xxx] [-cong=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
Examples
●Take the Windows OS as an example. Run the obsutil stat obs://bucket-test
command to query the basic properties of bucket bucket-test.
obsutil stat obs://bucket-test
Bucket:
obs://bucket-test
StorageClass:
standard
ObsVersion:
3.0
ObjectNumber:
8005
Size:
320076506
Quota:
0
Parameter Description
Parameter
bucketMandatoryBucket name
aclOptionalQueries the access control policies of the
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
ParameterOptional or
Mandatory
bfOptional
(additional
parameter)
congOptional
(additional
parameter)
eOptional
(additional
parameter)
iOptional
(additional
parameter)
Description
Display format of the used bucket capacity
(in bytes) Value options:
● human-readable
● raw
NOTE
If this parameter is not congured, the display
format of the used bucket capacity (in bytes) is
determined by the humanReadableFormat
parameter in the
conguration le.
User-dened conguration le for executing
a command. For details about parameters
that can be congured, see Parameter
Description.
Species the endpoint.
Species the user's AK.
Response
kOptional
Species the user's SK.
(additional
parameter)
tOptional
Species the user's security token.
(additional
parameter)
payerOptional
(additional
Species that requester-pays is enabled on a
bucket.
parameter)
Field
Description
BucketBucket name
StorageClassDefault storage class of the bucket
LocationRegion where the bucket resides
ObsVersionVersion of the bucket
BucketTypeType of a bucket. OBJECT indicates a bucket for object
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
ParameterOptional or
Mandatory
scOptional
(additional
parameter)
aclOptional
(additional
parameter)
Description
Default storage class of the bucket. Possible
values are:
● standard: OBS Standard, which features
low access latency and high throughput,
and is applicable to storing frequently
accessed data (multiple accesses per
month) or data that is smaller than 1
MB
● warm: OBS Infrequent Access. It is
applicable to storing infrequently
accessed (less than 12 times a year) data
that requires quick response.
● cold: OBS Archive. It is secure, durable,
and inexpensive, and applicable to
archiving rarely-accessed (once a year)
data.
Access control policies that can be specied
for buckets. Possible values are:
● private
● public-read
● public-read-write
NOTE
The preceding three values indicate private read
and write, public read, and public read and write.
● In AccessControlList, the Grant
the authorized users. Grantee
IDs of authorized users. Cannedspecies the
authorized user group (currently, only
Everyone is supported).
● The following permissions can be granted:
WRITE (write), WRITE_ACP (write ACL), READ
(read), READ_ACP (read ACL), and
FULL_CONTROL (full control).
Because angle brackets (<) and (>) are
unavoidably included in the parameter value, you
must use quotation marks to enclose them for
escaping when running the command. Use single
quotation marks for Linux or macOS and
quotation marks for Windows.
eld contains
species the
cong
Optional
(additional
parameter)
User-denedcongurationle for executing
a command. For details about parameters
that can be congured, see Parameter
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
ParameterOptional or
Mandatory
kOptional
(additional
parameter)
tOptional
(additional
parameter)
payerOptional
(additional
parameter)
Only one from sc, acl, or aclXml can be set for each command.
4.5 Deleting a Bucket
Description
Species the user's SK.
Species the user's security token.
Species that requester-pays is enabled on a
bucket.
Function
You can use this command to delete a bucket. The bucket to be deleted must be
empty (containing no objects, historical versions, or fragments).
To delete a non-empty bucket, run the commands in Deleting a Multipart Upload Task
and Deleting an Object to clear the bucket, and then run the following command to
delete the bucket.
Object Storage Service
Tool Guide (obsutil)4 Bucket Commands
Examples
●Take the Windows OS as an example. Run the obsutil bucketpolicy obs://
bucket -method=get -localle=d:\temp\policy.json command to export the
bucket policy to local le policy.json.