首页 > 解决方案 > 如何从私有服务器 scp 到 Amazon s3?

问题描述

我需要将文件从服务器 A 复制到 S3。

约束:

  1. A 在专用网络中。
  2. A 只能是来自 B 的 ssh。

我尝试了什么:
scp -i key.pem user@ip:/path/to/file >(aws s3 cp - s3://s3/uri)
此命令仅在文件名为-.

除了-给出错误的任何名称:
The user-provided path file does not exist.

标签: amazon-web-servicesamazon-s3centos7

解决方案


对不起这是我的错。
我认为-是源文件的名称。
因为当我尝试发送文件时,s3://s3/uri它只复制了一个名为-.

而是-表示使用 bash 的进程替换传递给 aws cli 的标准输入<()
现在,通过在 qn 中更改我的 cmd 来复制文件,如下所示
scp -i key.pem user@ip:/path/to/file >(aws s3 cp - s3://s3/uri/filename)


推荐阅读