【发布时间】:2021-08-26 17:07:36
【问题描述】:
我正在尝试通过我们的 Ruby on Rails 应用程序 dr-recommends 使用 https://github.com/aws/aws-sdk-ruby/blob/0465bfacbf87e6bc78c38191961ed860413d85cd/gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb#L697 实现 DynamoDB get_item 调用。
通过查看我编写的这个 DynamoDB CloudFormation 堆栈,我希望下面的 get_item 调用能够正常工作,所以我有点不知道如何继续。
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: 'pk'
AttributeType: 'S'
- AttributeName: 'sk'
AttributeType: 'S'
KeySchema:
- KeyType: 'HASH'
AttributeName: 'pk'
- KeyType: 'RANGE'
AttributeName: 'sk'
BillingMode: 'PAY_PER_REQUEST'
您是否在此处看到任何可以解释为什么以下调用可能不起作用的内容?
aws dynamodb get-item --table-name actual-table-name --key "{\"pk\":{\"S\":\"77119f89-d5bc-4662-91bb-f3e81e1d9b21\"}}" --projection-expression sk
# An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the schema
【问题讨论】:
标签: amazon-dynamodb amazon-cloudformation aws-cli