AWS-S3

AWS-S3

中国区价格

https://www.amazonaws.cn/s3/pricing/

存储类别

client安装配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
## 安装
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install

vi /etc/profile
export PATH=$PATH:/usr/local/bin

## 帮助
/usr/local/bin/aws s3 cp help

## 配置
/usr/local/bin/aws configure
AWS Access Key ID [None]: AKIAUPGCAPWX4FXXXXXX
AWS Secret Access Key [None]: SsOupysZ4ZBptxGCxPm+aLWq+dTfShrgsdXXXXXX
Default region name [None]: cn-northwest-1
Default output format [None]:

上传下载

1
2
3
4
5
/usr/local/bin/aws s3 cp mysqlbackup_all_202109280515.tar.gz s3://aas3
## 复制和排除文件夹
/usr/local/bin/aws s3 cp miniodata s3://aas3/permanent_backup/minio_backup/ --exclude sensordata/* --exclude .minio.sys/* --recursive

/usr/local/bin/aws s3 cp s3://aas3/AWSLogs/307497041326/vpcflowlogs/cn-northwest-1/2021/11/19/ . --recursive

挂载S3为文件系统

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## 1.参考文档
## https://aws.amazon.com/cn/blogs/china/s3fs-amazon-ec2-linux/

## 2.安装elep
yum install -y epel-release

## 3.安装s3fs-fuse
yum install s3fs-fuse -y

## 4.配置登录信息
echo AKIAUPGCAPWX6FD5N3CO:SsOupysZ4ZBptxGCxPm+aLWq+dTfShrgsdITVib4 > /etc/passwd-s3fs
chmod 600 /etc/passwd-s3fs

## 5.手工挂载
mkdir -p /s3mnt
s3fs hxs3 /s3mnt -o passwd_file=/etc/passwd-s3fs -o url=http://s3.cn-northwest-1.amazonaws.com.cn -o endpoint=cn-northwest-1

## 6.自动挂载
vi /etc/fstab
s3fs#hxs3 /s3mnt fuse allow_other,url=http://s3.cn-northwest-1.amazonaws.com.cn,endpoint=cn-northwest-1 0 0
mount -a

## 7.卸载
umount /s3mnt
umount -l /s3mnt