我有一个装满了上千份文件的桶。我如何搜索水桶?
当前回答
这里要补充一点:现在已经3年了,但当你输入“如何搜索S3 Bucket”时,这篇文章是谷歌的顶部。
也许你正在寻找一些更复杂的东西,但如果你在这里试图弄清楚如何简单地通过标题找到一个对象(文件),这是疯狂的简单:
打开桶,选择右边的“none”,并开始输入文件名。
http://docs.aws.amazon.com/AmazonS3/latest/UG/ListingObjectsinaBucket.html
其他回答
2018 - 07年现状: 亚马逊有本地sql像搜索csv和json文件!
https://aws.amazon.com/blogs/developer/introducing-support-for-amazon-s3-select-in-the-aws-sdk-for-javascript/
我尝试了以下方法
aws s3 ls s3://Bucket1/folder1/2019/ --recursive |grep filename.csv
这将输出文件存在的实际路径
2019-04-05 01:18:35 111111 folder1/2019/03/20/filename.csv
这不是一个技术性的答案,但我已经构建了一个允许通配符搜索的应用程序:https://bucketsearch.net/
它将异步索引您的bucket,然后允许您搜索结果。
它是免费使用的(捐赠软件)。
有多种选择,没有一个是简单的“一次性”全文解决方案:
Key name pattern search: Searching for keys starting with some string- if you design key names carefully, then you may have rather quick solution. Search metadata attached to keys: when posting a file to AWS S3, you may process the content, extract some meta information and attach this meta information in form of custom headers into the key. This allows you to fetch key names and headers without need to fetch complete content. The search has to be done sequentialy, there is no "sql like" search option for this. With large files this could save a lot of network traffic and time. Store metadata on SimpleDB: as previous point, but with storing the metadata on SimpleDB. Here you have sql like select statements. In case of large data sets you may hit SimpleDB limits, which can be overcome (partition metadata across multiple SimpleDB domains), but if you go really far, you may need to use another metedata type of database. Sequential full text search of the content - processing all the keys one by one. Very slow, if you have too many keys to process.
几年来,我们每天存储1440个版本的文件(每分钟一个),使用版本化桶,这是很容易实现的。但要获得一些较旧的版本需要时间,因为人们必须一个版本一个版本地按顺序进行。有时我使用简单的CSV记录索引,显示发布时间和版本id,有了这个,我可以很快跳转到旧版本。
正如你所看到的,AWS S3并不是为全文搜索而设计的,它是一个简单的存储服务。
快进到2020年,使用aws-okta作为我们的2fa,下面的命令,尽管迭代这个特定bucket(+270,000)中的所有对象和文件夹非常缓慢,但运行良好。
aws-okta exec dev -- aws s3 ls my-cool-bucket --recursive | grep needle-in-haystax.txt
推荐文章
- 如何查看所有地区所有正在运行的Amazon EC2实例?
- 如何从命令行使用多个AWS帐户?
- 如何搜索亚马逊s3桶?
- 拒绝访问;您需要(至少一个)SUPER特权来执行此操作
- 我如何使用通配符“cp”一组文件与AWS CLI
- 我如何获得亚马逊的AWS_ACCESS_KEY_ID ?
- 如何使所有对象在AWS S3桶公共默认?
- 为什么我应该使用亚马逊Kinesis而不是SNS-SQS?
- 如何重命名AWS S3 Bucket
- AWS ECS中的任务和服务之间有什么区别?
- 亚马逊SimpleDB vs亚马逊DynamoDB
- 亚马逊ECS和亚马逊EC2有什么区别?
- 我如何知道我在S3桶中存储了多少对象?
- S3 Bucket操作不应用于任何资源
- 将AWS凭证传递给Docker容器的最佳方法是什么?