使用gzip压缩文件以使用AWS命令进行传输 [英] Using gzip to compress files to transfer with aws command
本文介绍了使用gzip压缩文件以使用AWS命令进行传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ gzip file.txt | aws s3 cp file.txt.gz s3://my_bucket/
我正在尝试将file.txt压缩为file.txt.gz,并将其传递给以s3作为命令和cp作为子命令的aws程序.
I am trying to gzip file.txt to file.txt.gz and the passing it to aws program which has s3 as a command and cp as a subcommand.
生成:警告:正在跳过文件file.txt.gz.文件不存在.
Generates : warning: Skipping file file.txt.gz. File does not exist.
我是Linux的新手.有人可以帮忙吗?
I'm newbie in linux. Can anyone help on this please?
推荐答案
$ gzip -c file.txt | aws s3 cp - s3://my_bucket/file.txt.gz
除非您希望在本地拥有file.txt的.gz,否则,您可以一步完成gzip并进行传输,而将file.txt保持原样.
Unless you desire to have a .gz locally of file.txt, this allows you to accomplish the gzip and transfer in one step, leaving file.txt in tact.
现在,较新版本的AWS CLI允许您通过'-'字符以UNIX样式进行转换.
Newer versions of the AWS CLI now allow you to steam, UNIX style, via '-' character.
这篇关于使用gzip压缩文件以使用AWS命令进行传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文