DynamoDB.create_table erroring with `ArgumentError: no such member :billing_mode`
DynamoDB.create_table erroring with `ArgumentError: no such member :billing_mode`
我正在尝试使用 DynamoDB 客户端通过 aws-sdk(2.11.31) 创建一个新的 table;
new_table_definition = {
attribute_definitions: [
{
attribute_name: 'user',
attribute_type: 'S'
},
{
attribute_name: 'timestamp',
attribute_type: 'N'
},
{
attribute_name: 'uuid',
attribute_type: 'S'
}
],
key_schema: [
{
attribute_name: 'uuid',
key_type: 'HASH'
},
{
attribute_name: 'timestamp',
key_type: 'RANGE'
}
],
global_secondary_indexes: [
{
index_name: 'user-timestamp-index',
key_schema: [
{
attribute_name: 'user',
key_type: 'HASH'
},
{
attribute_name: 'timestamp',
key_type: 'RANGE'
}
],
projection: {
projection_type: 'KEYS_ONLY'
},
provisioned_throughput: {
read_capacity_units: 0,
write_capacity_units: 0,
}
}
],
billing_mode: "PAY_PER_REQUEST",
provisioned_throughput: {
read_capacity_units: 0,
write_capacity_units: 0
},
table_name: "A_NEW_TABLE"
}
Dynamo::Table.create(new_table_definition)
但是我收到以下错误:
ArgumentError: no such member :billing_mode
据我所知,这是 sdk v2 文档中描述的计费模式的正确密钥和格式。删除计费模式会创建 table 罚款,但我随后被迫进入 AWS 控制台以手动将其更改为按需模式。
Ruby - 2.3.0
Rails - 3.2.22.5
aws-sdk - 2.11.31
相关回溯:
2.3.3 :464 > Dynamo::Table.create(new_table_definition)
ArgumentError: no such member :billing_mode
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/seahorse/model/shapes.rb:212:in `member'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:165:in `block in structure'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:164:in `each'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:164:in `with_object'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:164:in `structure'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:152:in `apply'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:121:in `translate_input'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:111:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/idempotency_token.rb:18:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/param_converter.rb:20:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/seahorse/client/plugins/response_target.rb:21:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/seahorse/client/request.rb:70:in `send_request'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/seahorse/client/base.rb:207:in `block (2 levels) in define_operation_methods'
我特别遇到的问题是 gem 版本。好像不支持billing_mode.
我在测试较新版本时还发现的另一个问题实际上是同时发送 billing_mode 和 provisioned_throughput 值。这是 either/or 的情况。
If read/write capacity mode is PAY_PER_REQUEST the value is set to 0.
本文档中的这一行造成了混淆 https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/DynamoDB/Types/ProvisionedThroughput.html
看到这里它告诉你不要通过它:
https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/DynamoDB/Client.html#create_table-instance_method
我正在尝试使用 DynamoDB 客户端通过 aws-sdk(2.11.31) 创建一个新的 table;
new_table_definition = {
attribute_definitions: [
{
attribute_name: 'user',
attribute_type: 'S'
},
{
attribute_name: 'timestamp',
attribute_type: 'N'
},
{
attribute_name: 'uuid',
attribute_type: 'S'
}
],
key_schema: [
{
attribute_name: 'uuid',
key_type: 'HASH'
},
{
attribute_name: 'timestamp',
key_type: 'RANGE'
}
],
global_secondary_indexes: [
{
index_name: 'user-timestamp-index',
key_schema: [
{
attribute_name: 'user',
key_type: 'HASH'
},
{
attribute_name: 'timestamp',
key_type: 'RANGE'
}
],
projection: {
projection_type: 'KEYS_ONLY'
},
provisioned_throughput: {
read_capacity_units: 0,
write_capacity_units: 0,
}
}
],
billing_mode: "PAY_PER_REQUEST",
provisioned_throughput: {
read_capacity_units: 0,
write_capacity_units: 0
},
table_name: "A_NEW_TABLE"
}
Dynamo::Table.create(new_table_definition)
但是我收到以下错误:
ArgumentError: no such member :billing_mode
据我所知,这是 sdk v2 文档中描述的计费模式的正确密钥和格式。删除计费模式会创建 table 罚款,但我随后被迫进入 AWS 控制台以手动将其更改为按需模式。
Ruby - 2.3.0
Rails - 3.2.22.5
aws-sdk - 2.11.31
相关回溯:
2.3.3 :464 > Dynamo::Table.create(new_table_definition)
ArgumentError: no such member :billing_mode
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/seahorse/model/shapes.rb:212:in `member'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:165:in `block in structure'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:164:in `each'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:164:in `with_object'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:164:in `structure'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:152:in `apply'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:121:in `translate_input'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb:111:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/idempotency_token.rb:18:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/aws-sdk-core/plugins/param_converter.rb:20:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/seahorse/client/plugins/response_target.rb:21:in `call'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/seahorse/client/request.rb:70:in `send_request'
from shared/bundle/ruby/2.3.0/gems/aws-sdk-core-2.11.31/lib/seahorse/client/base.rb:207:in `block (2 levels) in define_operation_methods'
我特别遇到的问题是 gem 版本。好像不支持billing_mode.
我在测试较新版本时还发现的另一个问题实际上是同时发送 billing_mode 和 provisioned_throughput 值。这是 either/or 的情况。
If read/write capacity mode is PAY_PER_REQUEST the value is set to 0.
本文档中的这一行造成了混淆 https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/DynamoDB/Types/ProvisionedThroughput.html
看到这里它告诉你不要通过它: https://docs.aws.amazon.com/sdk-for-ruby/v2/api/Aws/DynamoDB/Client.html#create_table-instance_method