diff --git a/javascriptv3/example_code/dynamodb/actions/create-table.js b/javascriptv3/example_code/dynamodb/actions/create-table.js index 925c0103b02..9f2d22b698a 100644 --- a/javascriptv3/example_code/dynamodb/actions/create-table.js +++ b/javascriptv3/example_code/dynamodb/actions/create-table.js @@ -26,10 +26,7 @@ export const main = async () => { KeyType: "HASH", }, ], - ProvisionedThroughput: { - ReadCapacityUnits: 1, - WriteCapacityUnits: 1, - }, + BillingMode: "PAY_PER_REQUEST", }); const response = await client.send(command); diff --git a/javascriptv3/example_code/dynamodb/tests/delete-table.integration.test.js b/javascriptv3/example_code/dynamodb/tests/delete-table.integration.test.js index 8e0418081e2..1ca23a54e71 100644 --- a/javascriptv3/example_code/dynamodb/tests/delete-table.integration.test.js +++ b/javascriptv3/example_code/dynamodb/tests/delete-table.integration.test.js @@ -28,10 +28,7 @@ describe("delete-table", () => { KeyType: "HASH", }, ], - ProvisionedThroughput: { - ReadCapacityUnits: 1, - WriteCapacityUnits: 1, - }, + BillingMode: "PAY_PER_REQUEST", }); await client.send(createTableCommand); diff --git a/ruby/Gemfile b/ruby/Gemfile index 4cafb94cfc6..5dd220f262e 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '3.1.2' +ruby '3.3.7' gem 'aws-sdk' gem 'cli-ui' diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 923f7fe9eef..f758ba18ef2 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -1520,6 +1520,7 @@ GEM PLATFORMS arm64-darwin-22 + x64-mingw-ucrt x86_64-linux DEPENDENCIES @@ -1545,7 +1546,7 @@ DEPENDENCIES zip RUBY VERSION - ruby 3.1.2p20 + ruby 3.3.7p123 BUNDLED WITH 2.3.7 diff --git a/ruby/example_code/dynamodb/README.md b/ruby/example_code/dynamodb/README.md index 4256dd73186..60304150f70 100644 --- a/ruby/example_code/dynamodb/README.md +++ b/ruby/example_code/dynamodb/README.md @@ -184,4 +184,4 @@ To learn more about the contributing process, see [CONTRIBUTING.md](../../../CON Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -SPDX-License-Identifier: Apache-2.0 \ No newline at end of file +SPDX-License-Identifier: Apache-2.0 diff --git a/ruby/example_code/dynamodb/scaffold.rb b/ruby/example_code/dynamodb/scaffold.rb index b36f241f080..748ce88353c 100644 --- a/ruby/example_code/dynamodb/scaffold.rb +++ b/ruby/example_code/dynamodb/scaffold.rb @@ -68,7 +68,7 @@ def create_table(table_name) { attribute_name: 'year', attribute_type: 'N' }, { attribute_name: 'title', attribute_type: 'S' } ], - provisioned_throughput: { read_capacity_units: 10, write_capacity_units: 10 } + billing_mode: 'PAY_PER_REQUEST' ) @dynamo_resource.client.wait_until(:table_exists, table_name: table_name) @table diff --git a/rustv1/cross_service/photo_asset_management/integration/tests/update_label.rs b/rustv1/cross_service/photo_asset_management/integration/tests/update_label.rs index 1fec6f2d329..664d541d8e4 100644 --- a/rustv1/cross_service/photo_asset_management/integration/tests/update_label.rs +++ b/rustv1/cross_service/photo_asset_management/integration/tests/update_label.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use std::collections::HashMap; -use aws_sdk_dynamodb::types::{AttributeDefinition, KeySchemaElement, ProvisionedThroughput}; +use aws_sdk_dynamodb::types::{AttributeDefinition, KeySchemaElement, BillingMode}; use aws_sdk_rekognition::types::Label; use photo_asset_management::{ common::{init_tracing_subscriber, Common}, @@ -27,13 +27,8 @@ async fn create_table(common: &Common) -> Result<(), impl std::error::Error> { .attribute_definitions( AttributeDefinition::builder() .attribute_name("Label") - .attribute_type(aws_sdk_dynamodb::types::ScalarAttributeType::S) - .build(), - ) - .provisioned_throughput( - ProvisionedThroughput::builder() - .write_capacity_units(1) - .read_capacity_units(1) + .attribute_type(aws_sdk_dynamodb::types::ScalarAttributeType::S), + .billing_mode(aws_sdk_dynamodb::types::BillingMode::PayPerRequest) .build(), ) .send() diff --git a/rustv1/examples/dynamodb/src/bin/crud.rs b/rustv1/examples/dynamodb/src/bin/crud.rs index 9a5e4b1ae83..1f515945ec7 100644 --- a/rustv1/examples/dynamodb/src/bin/crud.rs +++ b/rustv1/examples/dynamodb/src/bin/crud.rs @@ -8,7 +8,7 @@ use aws_sdk_dynamodb::error::SdkError; use aws_sdk_dynamodb::operation::create_table::CreateTableError; use aws_sdk_dynamodb::operation::put_item::PutItemError; use aws_sdk_dynamodb::types::{ - AttributeDefinition, AttributeValue, KeySchemaElement, KeyType, ProvisionedThroughput, + AttributeDefinition, AttributeValue, BillingMode, KeySchemaElement, KeyType, ScalarAttributeType, Select, TableStatus, }; use aws_sdk_dynamodb::{config::Region, meta::PKG_VERSION, Client, Error}; @@ -63,18 +63,12 @@ async fn make_table( .build() .expect("creating KeySchemaElement"); - let pt = ProvisionedThroughput::builder() - .read_capacity_units(10) - .write_capacity_units(5) - .build() - .expect("creating ProvisionedThroughput"); - match client .create_table() .table_name(table) .key_schema(ks) .attribute_definitions(ad) - .provisioned_throughput(pt) + .billing_mode(BillingMode::PayPerRequest) .send() .await { diff --git a/rustv1/examples/dynamodb/src/bin/dynamodb-helloworld.rs b/rustv1/examples/dynamodb/src/bin/dynamodb-helloworld.rs index 07b62c2d12e..999bb036507 100644 --- a/rustv1/examples/dynamodb/src/bin/dynamodb-helloworld.rs +++ b/rustv1/examples/dynamodb/src/bin/dynamodb-helloworld.rs @@ -5,7 +5,7 @@ use aws_config::meta::region::RegionProviderChain; use aws_sdk_dynamodb::types::{ - AttributeDefinition, KeySchemaElement, KeyType, ProvisionedThroughput, ScalarAttributeType, + AttributeDefinition, BillingMode, KeySchemaElement, KeyType, ScalarAttributeType, }; use aws_sdk_dynamodb::{config::Region, meta::PKG_VERSION, Client, Error}; use clap::Parser; @@ -47,18 +47,12 @@ async fn create_table(client: &Client) -> Result<(), Error> { .build() .expect("creating AttributeDefinition"); - let pt = ProvisionedThroughput::builder() - .write_capacity_units(10) - .read_capacity_units(10) - .build() - .expect("creating ProvisionedThroughput"); - let new_table = client .create_table() .table_name("test-table") .key_schema(ks) .attribute_definitions(ad) - .provisioned_throughput(pt) + .billing_mode(BillingMode::PayPerRequest) .send() .await?; println!( diff --git a/rustv1/examples/dynamodb/src/bin/partiql.rs b/rustv1/examples/dynamodb/src/bin/partiql.rs index 1a1305d085b..e4e67486f97 100644 --- a/rustv1/examples/dynamodb/src/bin/partiql.rs +++ b/rustv1/examples/dynamodb/src/bin/partiql.rs @@ -8,7 +8,7 @@ use aws_sdk_dynamodb::error::SdkError; use aws_sdk_dynamodb::operation::create_table::CreateTableError; use aws_sdk_dynamodb::operation::execute_statement::ExecuteStatementError; use aws_sdk_dynamodb::types::{ - AttributeDefinition, AttributeValue, KeySchemaElement, KeyType, ProvisionedThroughput, + AttributeDefinition, AttributeValue, BillingMode, KeySchemaElement, KeyType, ScalarAttributeType, TableStatus, }; use aws_sdk_dynamodb::{config::Region, meta::PKG_VERSION, Client, Error}; @@ -44,7 +44,7 @@ fn random_string(n: usize) -> String { .collect() } -/// Create a new table. +/// Create a new on-demand table. // snippet-start:[dynamodb.rust.partiql-make_table] async fn make_table( client: &Client, @@ -63,18 +63,12 @@ async fn make_table( .build() .expect("creating KeySchemaElement"); - let pt = ProvisionedThroughput::builder() - .read_capacity_units(10) - .write_capacity_units(5) - .build() - .expect("creating ProvisionedThroughput"); - match client .create_table() .table_name(table) .key_schema(ks) .attribute_definitions(ad) - .provisioned_throughput(pt) + .billing_mode(BillingMode::PayPerRequest) .send() .await { diff --git a/rustv1/examples/dynamodb/src/scenario/create.rs b/rustv1/examples/dynamodb/src/scenario/create.rs index ea87771e641..ec127a1538c 100644 --- a/rustv1/examples/dynamodb/src/scenario/create.rs +++ b/rustv1/examples/dynamodb/src/scenario/create.rs @@ -4,11 +4,11 @@ use crate::scenario::error::Error; use aws_sdk_dynamodb::operation::create_table::CreateTableOutput; use aws_sdk_dynamodb::types::{ - AttributeDefinition, KeySchemaElement, KeyType, ProvisionedThroughput, ScalarAttributeType, + AttributeDefinition, BillingMode, KeySchemaElement, KeyType, ScalarAttributeType, }; use aws_sdk_dynamodb::Client; -// Create a table. +// Create an on-demand table. // snippet-start:[dynamodb.rust.create-table] pub async fn create_table( client: &Client, @@ -30,18 +30,12 @@ pub async fn create_table( .build() .map_err(Error::BuildError)?; - let pt = ProvisionedThroughput::builder() - .read_capacity_units(10) - .write_capacity_units(5) - .build() - .map_err(Error::BuildError)?; - let create_table_response = client .create_table() .table_name(table_name) .key_schema(ks) .attribute_definitions(ad) - .provisioned_throughput(pt) + .billing_mode(BillingMode::PayPerRequest) .send() .await; diff --git a/rustv1/examples/dynamodb/src/scenario/movies/startup.rs b/rustv1/examples/dynamodb/src/scenario/movies/startup.rs index 646c5bf4a24..246595c8026 100644 --- a/rustv1/examples/dynamodb/src/scenario/movies/startup.rs +++ b/rustv1/examples/dynamodb/src/scenario/movies/startup.rs @@ -5,8 +5,8 @@ use crate::scenario::error::Error; use aws_sdk_dynamodb::{ operation::create_table::builders::CreateTableFluentBuilder, types::{ - AttributeDefinition, KeySchemaElement, KeyType, ProvisionedThroughput, ScalarAttributeType, - TableStatus, WriteRequest, + AttributeDefinition, KeySchemaElement, KeyType, ScalarAttributeType, TableStatus, + WriteRequest, }, Client, }; @@ -14,8 +14,6 @@ use futures::future::join_all; use std::{collections::HashMap, time::Duration}; use tracing::{debug, info, trace}; -const CAPACITY: i64 = 10; - #[tracing::instrument(level = "trace")] pub async fn initialize(client: &Client, table_name: &str) -> Result<(), Error> { info!("Initializing Movies DynamoDB in {table_name}"); @@ -24,7 +22,7 @@ pub async fn initialize(client: &Client, table_name: &str) -> Result<(), Error> info!("Found existing table {table_name}"); } else { info!("Table does not exist, creating {table_name}"); - create_table(client, table_name, "year", "title", CAPACITY)? + create_table(client, table_name, "year", "title")? .send() .await?; await_table(client, table_name).await?; @@ -55,9 +53,8 @@ pub fn create_table( table_name: &str, primary_key: &str, sort_key: &str, - capacity: i64, ) -> Result { - info!("Creating table: {table_name} with capacity {capacity} and key structure {primary_key}:{sort_key}"); + info!("Creating table: {table_name} key structure {primary_key}:{sort_key}"); Ok(client .create_table() .table_name(table_name) @@ -89,13 +86,7 @@ pub fn create_table( .build() .expect("Failed to build attribute definition"), ) - .provisioned_throughput( - ProvisionedThroughput::builder() - .read_capacity_units(capacity) - .write_capacity_units(capacity) - .build() - .expect("Failed to specify ProvisionedThroughput"), - )) + .billing_mode(aws_sdk_dynamodb::types::BillingMode::PayPerRequest)) } // snippet-end:[dynamodb.rust.movies-create_table_request]