使用前缀将数据从 s3 复制到本地 [英] copy data from s3 to local with prefix
问题描述
我正在尝试使用 aws-cli 将数据从 s3 复制到带有前缀的本地.
I am trying to copy data from s3 to local with prefix using aws-cli.
但是我在使用不同的正则表达式时遇到错误.
But I am getting error with different regex.
aws s3 cp s3://my-bucket-name/RAW_TIMESTAMP_0506* . --profile prod
错误:
未找到匹配项:s3://my-bucket-name/RAW_TIMESTAMP_0506*
no matches found: s3://my-bucket-name/RAW_TIMESTAMP_0506*
推荐答案
aws s3 cp
命令不接受通配符作为文件名(键)的一部分.相反,您必须使用 --include
和 --exclude
参数来定义文件名.
The aws s3 cp
command will not accept a wildcard as part of the filename (key). Instead, you must use the --include
and --exclude
parameters to define filenames.
来自:使用排除和包含过滤器
目前,不支持在命令的路径参数中使用 UNIX 风格的通配符.但是,大多数命令都有 --exclude "
和 --include "
参数,可以实现所需的结果.这些参数执行模式匹配以排除或包含特定文件或对象.支持以下模式符号.
Currently, there is no support for the use of UNIX style wildcards in a command's path arguments. However, most commands have
--exclude "<value>"
and--include "<value>"
parameters that can achieve the desired result. These parameters perform pattern matching to either exclude or include a particular file or object. The following pattern symbols are supported.
所以,你会使用类似的东西:
So, you would use something like:
aws s3 cp s3://my-bucket-name/ . --include "RAW_TIMESTAMP_0506*"
这篇关于使用前缀将数据从 s3 复制到本地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!