大网数据广告活动
服务器运维问答

Rsync to AWS S3 bucket

· 52CE 我爱测

For a server I am hosting a website on I want to backup the data and settings to an S3 bucket. I found out that you can't directly use rsync to backup to an S3 bucket. Is there another way to achieve the following rsync command t…

问题原文

原帖链接 · Bart Bergmans · CC BY-SA 3.0

For a server I am hosting a website on I want to backup the data and settings to an S3 bucket. I found out that you can't directly use rsync to backup to an S3 bucket. Is there another way to achieve the following rsync command to backup the data to an S3 bucket?

rsync -­av ­/Data /s3bucket

I also want to backup the mysql database on that server to the S3 bucket. What is the best way to achieve this?

Last question, if I managed to backup everything to the S3. What is the best way restore the server if it's crashed or in worst case completely wiped? Do I have to note the server settings myself and reconfigure the server or is there a way to also backup this?

已采纳解答

原帖链接 · Gaurav Pundir · CC BY-SA 4.0

To communicate to s3 you need to have 2 things

  1. IAM user credentials who has read-write access to s3 bucket.
  2. A client like aws-cli for bash, boto library for Python etc.

once you have both, you can transfer any file from your machine to s3 and from s3 to your machine. Below is the example for aws-cli.

To sync all files in a folder

aws s3 sync source_folder  s3://your_bucket_name/destination_folder/

To copy one file to s3

aws s3 cp source_file s3://your_bucket_name/destination_folder/

Just replace source & destination in the command to download any file from s3.

for more info follow aws docs

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。