华为云OBS命令行工具 (适用于Linux)

一、下载与安装obsutil (适用于centos7)

1、下载安装包

wget https://obs-community.obs.cn-north-1.myhuaweicloud.com/obsutil/current/obsutil_linux_amd64.tar.gz

2、解压并设置可执行权限

tar -xzvf obsutil_linux_amd64.tar.gz
chmod 755 obsutil 

二、准备环境

1、注册华为云账号,开通OBS服务,创建访问密钥。

2、初始化配置

./obsutil config -i=获取方式参考https://support.huaweicloud.com/utiltg-obs/obs_11_0004.html创建访问密钥 -k=同上 -e=获取方式参考https://developer.huaweicloud.com/endpoint?OBS

3、检查连通性

[root@ecs-3ec9-rs-c7dc obsutil_linux_amd64_5.2.12]# ./obsutil ls -s
Start at 2021-05-19 07:20:33.099735757 +0000 UTC

obs://beijing-data-4
obs://by-testing
obs://my-images-00986
obs://parallelfilesystem001
Bucket number is: 4(出现这个表示正确)

三、操作流程

华为云OBS命令行工具 (适用于Linux)

1、创建桶

[root@ecs-3ec9-rs-c7dc obsutil_linux_amd64_5.2.12]# ./obsutil mb obs://my.bucket123(桶名) -location=cn-east-3(所属区域)
Start at 2021-05-19 07:24:39.814351513 +0000 UTC

Create bucket [my.bucket123] successfully, request id [000001798383221B91539A4E59C415D6]

2、上传文件

[root@ecs-3ec9-rs-c7dc obsutil_linux_amd64_5.2.12]# ./obsutil cp -r(递归) /root/obsutil_linux_amd64_5.2.12(本地文件) obs://my.bucket123(桶名)

3、下载文件

[root@ecs-3ec9-rs-c7dc obsutil_linux_amd64_5.2.12]# ./obsutil cp obs://my-images-00986/promotion/789.jpg(OBS中存储的文件) /root(本地目录)

4、删除文件

[root@ecs-3ec9-rs-c7dc obsutil_linux_amd64_5.2.12]# ./obsutil rm obs://my.bucket123/obsutil_linux_amd64_5.2.12/setup.sh(桶中路径)

5、删除桶

root@ecs-3ec9-rs-c7dc obsutil_linux_amd64_5.2.12]# ./obsutil rm obs://my.bucket123(桶名)

 

上一篇:Centos7下安装 prometheus


下一篇:Ubuntu使用dpkg查看与修改architecture的用法