英文:
How to upload an in-memory string value to s3 with AWS CLI
问题
可以使用aws s3 cp
命令直接上传字符串值到S3,而无需先将其保存到磁盘上。
英文:
I usually upload in-memory objects to s3 using boto3 (in Python). Is there a way, I can upload a string value directly to s3 without saving it on the disk first, using the aws s3 cp
cli command?
答案1
得分: 2
aws s3api put-object
命令接受一个 blob
作为要上传的文件内容。
或者,您可以通过 stdin
传递内容:
aws s3 cp - s3://my-bucket/file.txt
-
表示它应该从 stdin
读取内容。
英文:
The aws s3api put-object
command accepts a blob
as the content of the file being uploaded.
Alternatively, you can pass content via stdin
:
aws s3 cp - s3://my-bucket/file.txt
The -
indicates that it should read the content from stdin
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论