Skip to content

Latest commit

 

History

History
84 lines (57 loc) · 1.46 KB

dynamodb.rst

File metadata and controls

84 lines (57 loc) · 1.46 KB

DynamoDB

List Tables

aws dynamodb list-tables | jq -r .TableNames[]
userdata_hk
userdata_vn
userdata_sg
providers
events

Get All Items from a Table

|:warning:| This command will stream ALL items untill SIGINT is sent

aws dynamodb scan --table-name events

Get Item Count from a Table

aws dynamodb scan --table-name events --select COUNT | jq .ScannedCount
726119

Get Item using Key

aws dynamodb get-item --table-name events --key '{"email": {"S": "admin@mdminhazulhaque.io"}}'
{
    "Item": {
        "email": {
            "S": "admin@mdminhazulhaque.io"
        },
        "created_at": {
            "N": "1554780667296"
        },
        "event_type": {
            "S": "DISPATCHED"
        }
    }
}

Get Specific Fields from an Item

aws dynamodb get-item --table-name events --key '{"email": {"S": "admin@mdminhazulhaque.io"}}' --attributes-to-get event_type
{
    "Item": {
        "event_type": {
            "S": "DISPATCHED"
        }
    }
}

Delete Item using Key

aws dynamodb delete-item --table-name events --key '{"email": {"S": "admin@mdminhazulhaque.io"}}'