使用CLI将文件上传到AWS S3,而不是使用本地文件,而是提供一个URL。

huangapple go评论72阅读模式
英文:

upload a file to aws s3 with CLI by giving an url instead of a local file

问题

我们使用AWS S3和CLI(aws命令行界面)将图片从我们的服务器移动到一个存储桶中。现在,我们使用另一个系统,它以URL形式提供这些文件(图片)。与其先下载这些文件,然后使用mv命令将它们上传到AWS S3,我们更希望能够直接从URL将文件上传到S3中,使用CLI。问题:这是否可能?我认为不可能,因为我找不到与此相关的任何信息。

例如:
旧命令:aws s3 mv . s3://.../demo.png

新命令:aws s3 mv https://anurl/demosource.png s3://.../demo.png

英文:

we use AWS S3 and CLI (aws command line interface) to move pictures from our server into a bucket. Now, we use another system which delivers those files (pictures) as urls. Instead of downloading this files and then uploading them to aws s3 with the mv command, we would prefer to upload the files directly from the url into s3 with cli. Question: is this possible? I assume no, because I was not able to find any information about this.

example:
old command: aws s3 mv . s3://.../demo.png

new command: aws s3 mv https://anurl/demosource.png s3://.../demo.png

答案1

得分: 2

AWS命令行界面(CLI) 只能复制文件到/从:

  • 本地路径
  • Amazon S3 存储桶

不可能要求 Amazon S3 通过 URL 检索对象。

您可以编写一个 AWS Lambda 函数,它会下载文件并将其上传到 Amazon S3。这将非常快,因为它不需要经过您的计算机。

英文:

The AWS Command-Line Interface (CLI) can only copy files to/from:

  • A local path
  • An Amazon S3 bucket

It is not possible to request Amazon S3 to retrieve an object via a URL.

You could write an AWS Lambda function that downloads a file and uploads it to Amazon S3. This would be fast because it does not need to pass through your computer.

huangapple
  • 本文由 发表于 2023年3月3日 19:06:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75626290.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定