How to download files from  Cloud Object Storage Service (OSS) to Local system4 min read

Devops Engineer
Sorry! The Author has not filled his profile.
follow me

Hi All

In our last article, we have seen how to Create Object Storage Service (OSS) bucket and Create a RAM user in Alibaba Cloud. & How to Copy files to Alibaba Cloud Object Storage Service  Now we will see how to download files from  Cloud Object Storage Service (OSS) to Local system.

Requirements
OSS should be already activated and RAM user should be created and Access Key and Secret Key should be required. If you not yet created, Kindly go through our previous article how to Create Object Storage Service (OSS) bucket and Create a RAM user in Alibaba Cloud.

OSSUTIL

Ossutil allows us to manage OSS data easily through command lines and easy to manage or use through commands for bucket and object management.

Download ossutil installation file.

wget http://gosspublic.alicdn.com/ossutil/1.6.1/ossutil64

Change the permission of the file

chmod 755 ossutil64

[root@techrunnr1 ~]# wget http://gosspublic.alicdn.com/ossutil/1.6.1/ossutil64
--2019-07-06 08:06:24--  http://gosspublic.alicdn.com/ossutil/1.6.1/ossutil64
Resolving gosspublic.alicdn.com (gosspublic.alicdn.com)... 94.207.37.97, 94.207.37.96
Connecting to gosspublic.alicdn.com (gosspublic.alicdn.com)|94.207.37.97|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9641827 (9.2M) [application/octet-stream]
Saving to: ‘ossutil64’

100%[=====================================================================================================================================================================>] 96,41,827   58.1MB/s   in 0.2s   

2019-07-06 08:06:24 (58.1 MB/s) - ‘ossutil64’ saved [9641827/9641827]

[root@techrunnr1 ~]# chmod 755 ossutil64

Configure ossutil64

[root@techrunnr1 ~]# ./ossutil64 config
The command creates a configuration file and stores credentials.

Please enter the config file path(default /root/.ossutilconfig, carriage return will use the default path. If you specified this option to other path, you should specify --config-file option to the path when you use other commands):
No config file entered, will use the default config file /root/.ossutilconfig

For the following settings, carriage return means skip the configuration. Please try "help config" to see the meaning of the settings
Please enter language(CH/EN, default is:EN, the configuration will go into effect after the command successfully executed):EN
Please enter accessKeySecret:**********************
Please enter stsToken:
Please enter endpoint:https://oss-me-east-1.aliyuncs.com
Please enter accessKeyID:**********
[root@techrunnr1 ~]# 

endpoint: Endpoint of the region where the bucket belongs to. For more information, see Regions and endpoints.

accessKeyID: You can refer to our previous article.

accessKeySecret: You can refer to our previous article.

stsToken: This option is required only if we are using temporary STS token to access the OSS bucket.Otherwise, we can leave it blank.

Now configuring ossutil has been done.Let’s list the OSS bucket through ossutil command.

./ossutil64 ls

[root@techrunnr1 ~]# ./ossutil64 ls
CreationTime                                 Region    StorageClass    BucketName
2019-05-06 06:14:36 +0000 UTC         oss-me-east-1        Standard    oss://sample-bucket1
Bucket Number is: 1

0.071467(s) elapsed
[root@techrunnr1 ~]# 

 

In web console,lets see

ossutil-oss-admin-credentials

Now let’s see how to download one file from  OSS bucket to local directory through command line using ossutil.

/root/ossutil64 cp  oss://sample-bucket1/testuploadfile/file1.txt  testfolder/

 

 

How to copy a folder from OSS bucket to local directory through command Line using ossutil

/root/ossutil64 cp -r  oss://sample-bucket1/samplefolder testfolder/

 

For help we can use.
/root/ossutil64 help

There are lot of options in ossutil,we will see the other commonly used option later.

© 2020, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Related posts

Leave a Reply