Articles → AWS → Create A DynamoDB Table Using AWS CLI
Create A DynamoDB Table Using AWS CLI
Configure CLI
Write Command To Create A Table
- Id
- 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 Name | Description |
---|
--table-name | Specifies the name of the table |
--attribute-definitions | Specifies the column name (AttributeName attribute) and their data types (AttributeType attribute). |
--key-schema | Specifies 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
Click to Enlarge