Tạo table

  1. Khởi động AWS CloudShell tại Giao diện CloudShell

  2. Gõ lệnh aws configure

  3. Nhập chi tiết thông tin từ file csv ở phần 2.1.1 Tạo Access key:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default region name
  • Default output format

Create Table Dashboard!

  1. Để tạo table, ta sử dụng lệnh create-table . Gõ lệnh:
aws dynamodb create-table \
    --table-name Music \
    --attribute-definitions \
        AttributeName=Artist,AttributeType=S \
        AttributeName=SongTitle,AttributeType=S \
    --key-schema \
        AttributeName=Artist,KeyType=HASH \
        AttributeName=SongTitle,KeyType=RANGE \
    --provisioned-throughput \
        ReadCapacityUnits=10,WriteCapacityUnits=5 \
    --table-class STANDARD
  1. Kết quả:
  • Kết quả trên AWS CloudShell:
{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "Artist",
                "AttributeType": "S"
            },
            {
                "AttributeName": "SongTitle",
                "AttributeType": "S"
            }
        ],
        "TableName": "Music",
        "KeySchema": [
            {
                "AttributeName": "Artist",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "SongTitle",
                "KeyType": "RANGE"
            }
        ],
        "TableStatus": "CREATING",
        "CreationDateTime": "2022-02-08T06:15:18.343000+00:00",
        "ProvisionedThroughput": {
            "NumberOfDecreasesToday": 0,
            "ReadCapacityUnits": 10,
            "WriteCapacityUnits": 5
        },
        "TableSizeBytes": 0,
        "ItemCount": 0,
        "TableArn": "arn:aws:dynamodb:us-east-2:089359461550:table/Music",
        "TableId": "4b2a1e9a-c223-4b07-a536-c4b85a67df96",
        "TableClassSummary": {
            "TableClass": "STANDARD"
        }
    }
}
  • Kết quả trên giao diện:

Createb Table CloudShell!

  1. Kiểm tra trạng thái table:
  • Gõ lệnh:
aws dynamodb describe-table --table-name Music | grep TableStatus
  • Khi DynamoDB hoàn thành việc tạo table, giá trị của TableStatusACTIVE: "TableStatus": "ACTIVE",