Live

"Your daily source of fresh and trusted news."

Managing DynamoDB Tables with AWS CLI: Step-by-Step Instructions

Published on Jan 20, 2026 · Tessa Rodriguez

Working with cloud databases often feels faster when you can skip the browser and get straight to the point. AWS DynamoDB, a fully managed NoSQL service, is widely used for its simplicity and scalability — but managing it through the web console can feel clunky, especially for repetitive tasks. That’s where the AWS Command Line Interface (CLI) comes in handy.

With a few commands, you can create, update, monitor, and delete DynamoDB tables directly from your terminal. It’s scriptable, reliable, and easy to fit into automated workflows. This guide walks through clear, practical steps to create and manage DynamoDB tables using AWS CLI without unnecessary complexity.

How to Create and Manage DynamoDB Tables Using AWS CLI?

Setting Up AWS CLI

Before working with DynamoDB from the command line, you’ll need to set up the AWS CLI on your machine. Download the installer from AWS, follow the simple steps, and you’re ready to go. To connect it to your account, run:

aws configure

You’ll be asked for your access key, secret key, default region, and preferred output format. These tell the CLI which account and region to work with. Be sure the IAM user or role you’re using has permission to work with DynamoDB — otherwise, some commands won’t work. Once configured, you’re ready to create and manage tables easily.

Creating a DynamoDB Table

Once your AWS CLI is set up and configured, creating a DynamoDB table becomes straightforward. The command itself is short, but understanding what each part does helps you avoid mistakes and design your table properly. You’ll need to decide on the table name, the key schema, attribute types, and how you want to handle capacity — either on-demand or provisioned throughput.

For a simple example, let’s create a Users table where UserId is the unique identifier:

aws dynamodb create-table \

--table-name Users \

--attribute-definitions AttributeName=UserId,AttributeType=S \

--key-schema AttributeName=UserId,KeyType=HASH \

--billing-mode PAY_PER_REQUEST

This sets up UserId as a string and uses it as the partition key. The PAY_PER_REQUEST billing mode means you don’t have to pre-allocate read/write units — DynamoDB scales automatically and charges you for what you use.

If you’d rather control capacity yourself, you can switch to provisioned throughput by adding:

--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5

For more complex scenarios, you can define a composite primary key and even add secondary indexes. For example, this command creates an Orders table with OrderId as the partition key, CustomerId as the sort key, and a global secondary index to make it easy to query by customer:

aws dynamodb create-table \

--table-name Orders \

--attribute-definitions \

AttributeName=OrderId,AttributeType=S \

AttributeName=CustomerId,AttributeType=S \

--key-schema \

AttributeName=OrderId,KeyType=HASH \

AttributeName=CustomerId,KeyType=RANGE \

--billing-mode PAY_PER_REQUEST \

--global-secondary-indexes \

'[{

"IndexName":"CustomerIndex",

"KeySchema":[{"AttributeName":"CustomerId","KeyType":"HASH"}],

"Projection":{"ProjectionType":"ALL"}

}]'

This approach gives you flexibility while keeping your data organized for efficient access.

Verifying Table Creation

After running a create-table command, the CLI returns a JSON output describing the table’s properties. However, the table creation process is asynchronous. The table status starts as CREATING. You can check its status with:

aws dynamodb describe-table --table-name Users

This output includes the current status. Once it changes to ACTIVE, the table is ready to use.

You can also list all your tables with:

aws dynamodb list-tables

Updating a Table

Sometimes, you need to make changes to an existing table. While you cannot directly change the primary key, you can adjust provisioned throughput (if not using on-demand mode), add or delete global secondary indexes, and modify table capacity. For example, to increase write capacity:

aws dynamodb update-table \

--table-name Users \

--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=10

To add a global secondary index:

aws dynamodb update-table \

--table-name Users \

--attribute-definitions AttributeName=Email,AttributeType=S \

--global-secondary-index-updates \

'[{

"Create": {

"IndexName": "EmailIndex",

"KeySchema": [

{"AttributeName":"Email","KeyType":"HASH"}

],

"Projection": {

"ProjectionType":"ALL"

},

"ProvisionedThroughput": {

"ReadCapacityUnits": 5,

"WriteCapacityUnits": 5

}

}

}]'

This adds an index called EmailIndex to allow efficient lookups by email. The index is created asynchronously, and you can monitor its status using the describe-table command.

Deleting a Table

When you no longer need a table, you can remove it easily:

aws dynamodb delete-table --table-name Users

This deletes the table and all its data. Be cautious with this action because the data cannot be recovered after deletion.

Backing Up and Restoring

It’s good practice to back up your tables periodically. You can create on-demand backups using:

aws dynamodb create-backup --table-name Users --backup-name UsersBackup

The output gives you a BackupArn, which you can use to restore the backup later:

aws dynamodb restore-table-from-backup \

--target-table-name UsersRestored \

--backup-arn <BackupArn>

This creates a new table from the backup. You can also use point-in-time recovery if it’s enabled on the table to restore it to any moment within the last 35 days.

Monitoring Tables

Monitoring is an important part of managing DynamoDB tables. The CLI allows you to enable or disable point-in-time recovery, check the table’s status, and view metrics through CloudWatch. For example, to enable point-in-time recovery:

aws dynamodb update-continuous-backups \

--table-name Users \

--point-in-time-recovery-specification PointInTimeRecoveryEnabled=true

You can then use CloudWatch to monitor read and write throughput, throttled requests, and other key metrics to keep your tables healthy and performant.

Conclusion

Managing DynamoDB tables through the AWS CLI offers flexibility and efficiency for developers and administrators who prefer working in a terminal. From creating simple tables to defining complex schemas with indexes, the CLI provides clear commands that can be integrated into scripts and workflows. Backing up and restoring data, adjusting throughput, and monitoring your tables become much simpler when you’re familiar with these commands. This hands-on way of working helps you stay close to your infrastructure and gives you confidence in how your data is organized and maintained.

You May Like