Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for YDB
  • Getting started
  • Access management
      • Setting up AWS tools
      • Working with data through the HTTP interface
        • Overview
        • Creating a table
        • Adding data to a table
        • Reading data from a table
        • Updating data
        • Data selections
        • Deleting the resources you created
    • Common errors when working with the Document API
  • Monitoring metrics
  • Audit Trails events
  • FAQ
  • Public materials
  1. Amazon DynamoDB-compatible Document API
  2. Tools
  3. Working with the AWS CLI
  4. Creating a table

Creating a table in the AWS CLI

Written by
Yandex Cloud
Updated at January 30, 2024
AWS CLI

Warning

To work with the AWS CLI from Windows, we recommend using the WSL.

If you do not have the AWS CLI yet, install and configure it.

To create a series table with a partitioning key by series number and sort key by series name:

  1. Prepare the Document API endpoint and specify it:

    endpoint=<your_DB_endpoint>
    
  2. Run this command:

    aws dynamodb create-table \
      --table-name <table_name> \
      --attribute-definitions \
        AttributeName=<series_number>,AttributeType=N \
        AttributeName=<series_name>,AttributeType=S \
        AttributeName=<series_description>,AttributeType=S \
        AttributeName=<series_release_date>,AttributeType=S \
      --key-schema \
        AttributeName=<series_number>,KeyType=HASH \
        AttributeName=<series_name>,KeyType=RANGE \
      --endpoint $endpoint
    

    Where:

    • --table-name: Table name.
    • --attribute-definitions: Description of element attributes. AttributeName: Attribute name. AttributeType: Attribute type:
      • N: Number type.
      • S: String type.
      • B: Binary type.
    • --key-schema: Key schema for the table. AttributeName: Name of the key attribute. KeyType: Key type:
      • HASH: Partitioning key.
      • RANGE: Sort key.

    The key-schema attributes should also be defined in the attribute-definitions array.

ExampleExample

To create a table named series with the series_id partition key and the title sort key:

endpoint="your-database-endpoint"
aws dynamodb create-table \
  --table-name series \
  --attribute-definitions \
    AttributeName=series_id,AttributeType=N \
    AttributeName=title,AttributeType=S \
    AttributeName=series_info,AttributeType=S \
    AttributeName=release_date,AttributeType=S \
  --key-schema \
    AttributeName=series_id,KeyType=HASH \
    AttributeName=title,KeyType=RANGE \
  --endpoint $endpoint

Result:

{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "series_id",
                "AttributeType": "N"
            },
            {
                "AttributeName": "title",
                "AttributeType": "S"
            },
            {
                "AttributeName": "series_info",
                "AttributeType": "S"
            },
            {
                "AttributeName": "release_date",
                "AttributeType": "S"
            }
        ],
        "TableName": "series",
        "KeySchema": [
            {
                "AttributeName": "series_id",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "title",
                "KeyType": "RANGE"
            }
        ],
        "TableStatus": "ACTIVE",
        "CreationDateTime": "2020-12-27T13:21:10+00:00",
        "TableSizeBytes": 0,
        "ItemCount": 0
    }
}

Was the article helpful?

Previous
Overview
Next
Adding data to a table
© 2025 Direct Cursus Technology L.L.C.