简体   繁体   English

AWS 通过 CLI 打印 DynamoDB 表

[英]AWS Printing DynamoDB Table Via CLI

I'm trying to find the right command to use in the CLI to print the contents of a table within DynamoDB.我试图找到在 CLI 中使用的正确命令来打印 DynamoDB 中的表的内容。

I've tried using the following command but it gives me a "parameter validation failed" error.我试过使用以下命令,但它给了我一个“参数验证失败”错误。

` `

aws dynamodb get-item \
    --table-name Traffic \
    --key file://traffic.json \
    --return-consumed-capacity TOTAL

` `

The AWS website is giving me a 403 error, at the moment, so I can't search for the solution through the official site. AWS 网站目前给我一个 403 错误,所以我无法通过官方网站搜索解决方案。

To get all items in a table, use a scan operation, not a get item operation.要获取表中的所有项目,请使用扫描操作,而不是获取项目操作。 This basic scan operation works fine with the CLI:此基本扫描操作适用于 CLI:

aws dynamodb scan --table-name Work aws dynamodb 扫描--表名工作

在此处输入图像描述

You can find all valid options here:您可以在此处找到所有有效选项:

https://docs.aws.amazon.com/cli/latest/reference/dynamodb/scan.html https://docs.aws.amazon.com/cli/latest/reference/dynamodb/scan.html

You can run the Scan API to output how the table looks in DynamoDB JSON format.您可以运行Scan API 到 output 表在 DynamoDB JSON 格式中的外观。

aws dynamodb scan \
--table-name test \
--output text

If you have a list of keys to fetch in your traffic.json file then you should use batch-get-item .如果您有要在 traffic.json 文件中获取的密钥列表,那么您应该使用batch-get-item

If it's a single item you need then please share the contents of traffic.json file.如果您需要的是单个项目,请分享 traffic.json 文件的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM