英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论