Articles → AWS → Create A DynamoDB Table Using AWS CLI

Create A DynamoDB Table Using AWS CLI






Configure CLI





Write Command To Create A Table




  1. Id
  2. ArticleName


aws dynamodb create-table --table-name Articles --attribute-definitions  AttributeName=Id,AttributeType=N  AttributeName=ArticleName,AttributeType=S --key-schema AttributeName=Id,KeyType=HASH AttributeName=ArticleName,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1




Attribute NameDescription
--table-name Specifies the name of the table
--attribute-definitionsSpecifies the column name (AttributeName attribute) and their data types (AttributeType attribute).
--key-schemaSpecifies the partition key and the sort key.

KeyType = HASH means partition key and
KeyType = RANGE means sort key
--provisioned-throughput Specifies the read and write capacity.




{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "ArticleName",
                "AttributeType": "S"
            },
            {
                "AttributeName": "Id",
                "AttributeType": "N"
            }
        ],
        "TableName": "Articles",
        "KeySchema": [
            {
                "AttributeName": "Id",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "ArticleName",
                "KeyType": "RANGE"
            }
        ],
        "TableStatus": "CREATING",
        "CreationDateTime": "2024-06-04T14:06:01.453000+05:30",
        "ProvisionedThroughput": {
            "NumberOfDecreasesToday": 0,
            "ReadCapacityUnits": 1,
            "WriteCapacityUnits": 1
        },
        "TableSizeBytes": 0,
        "ItemCount": 0,
        "TableArn": "arn:aws:dynamodb:ap-south-1:462618770999:table/Articles",
        "TableId": "c2dfc7f3-be7a-4c20-a5a6-57d07895188e"
    }
}



Output


Picture showing the table created in dynamodb
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, February 3, 2022
 
Updated On  -  Wednesday, June 5, 2024

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250