Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Connect to a local DynamoDB instance using an AWS SDK

Focus mode
Connect to a local DynamoDB instance using an AWS SDK - Amazon DynamoDB

The following code example shows how to override an endpoint URL to connect to a local development deployment of DynamoDB and an AWS SDK.

For more information, see DynamoDB Local.

Rust
SDK for Rust
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

/// Lists your tables from a local DynamoDB instance by setting the SDK Config's /// endpoint_url and test_credentials. #[tokio::main] async fn main() { tracing_subscriber::fmt::init(); let config = aws_config::defaults(aws_config::BehaviorVersion::latest()) .test_credentials() // DynamoDB run locally uses port 8000 by default. .endpoint_url("http://localhost:8000") .load() .await; let dynamodb_local_config = aws_sdk_dynamodb::config::Builder::from(&config).build(); let client = aws_sdk_dynamodb::Client::from_conf(dynamodb_local_config); let list_resp = client.list_tables().send().await; match list_resp { Ok(resp) => { println!("Found {} tables", resp.table_names().len()); for name in resp.table_names() { println!(" {}", name); } } Err(err) => eprintln!("Failed to list local dynamodb tables: {err:?}"), } }
SDK for Rust
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

/// Lists your tables from a local DynamoDB instance by setting the SDK Config's /// endpoint_url and test_credentials. #[tokio::main] async fn main() { tracing_subscriber::fmt::init(); let config = aws_config::defaults(aws_config::BehaviorVersion::latest()) .test_credentials() // DynamoDB run locally uses port 8000 by default. .endpoint_url("http://localhost:8000") .load() .await; let dynamodb_local_config = aws_sdk_dynamodb::config::Builder::from(&config).build(); let client = aws_sdk_dynamodb::Client::from_conf(dynamodb_local_config); let list_resp = client.list_tables().send().await; match list_resp { Ok(resp) => { println!("Found {} tables", resp.table_names().len()); for name in resp.table_names() { println!(" {}", name); } } Err(err) => eprintln!("Failed to list local dynamodb tables: {err:?}"), } }

For a complete list of AWS SDK developer guides and code examples, see Using DynamoDB with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.