Skip to content

Instantly share code, notes, and snippets.

@deangiberson
Created January 24, 2018 07:11
Show Gist options
  • Save deangiberson/eb1adb8b96df4e01562cb23afb8462ac to your computer and use it in GitHub Desktop.
Save deangiberson/eb1adb8b96df4e01562cb23afb8462ac to your computer and use it in GitHub Desktop.
aws --endpoint-url=http://localhost:4569 dynamodb create-table \
--table-name MusicCollection \
--attribute-definitions \
AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S \
--key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE \
--provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 \
--stream-specification StreamEnabled=true,StreamViewType=NEW_IMAGE
{
"TableDescription": {
"TableArn": "arn:aws:dynamodb:us-east-1:000000000000:table/MusicCollection",
"AttributeDefinitions": [
{
"AttributeName": "Artist",
"AttributeType": "S"
},
{
"AttributeName": "SongTitle",
"AttributeType": "S"
}
],
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"WriteCapacityUnits": 1,
"LastIncreaseDateTime": 0.0,
"ReadCapacityUnits": 1,
"LastDecreaseDateTime": 0.0
},
"TableSizeBytes": 0,
"TableName": "MusicCollection",
"TableStatus": "ACTIVE",
"StreamSpecification": {
"StreamViewType": "NEW_IMAGE",
"StreamEnabled": true
},
"LatestStreamLabel": "2018-01-24T06:26:19.684",
"KeySchema": [
{
"KeyType": "HASH",
"AttributeName": "Artist"
},
{
"KeyType": "RANGE",
"AttributeName": "SongTitle"
}
],
"ItemCount": 0,
"CreationDateTime": 1516775179.684,
"LatestStreamArn": "arn:aws:dynamodb:ddblocal:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19.684"
}
}
aws --endpoint-url=http://localhost:4569 dynamodb put-item --table-name MusicCollection --item '{"Artist":{"S":"Prince"},"SongTitle":{"S":"Purple Rain"}}'
aws --endpoint-url=http://localhost:4569 dynamodb put-item --table-name MusicCollection --item '{"Artist":{"S":"Michael Jackson"},"SongTitle":{"S":"Thriller"}}'
aws --endpoint-url=http://localhost:4570 dynamodbstreams list-streams
{
"LastEvaluatedStreamArn": "TODO",
"Streams": [
{
"TableName": "MusicCollection",
"StreamArn": "arn:aws:dynamodb:us-east-1:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19",
"StreamLabel": "TODO"
}
]
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams describe-stream --stream-arn 'arn:aws:dynamodb:us-east-1:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19'
{
"StreamDescription": {
"StreamLabel": "TODO",
"StreamStatus": "ENABLED",
"TableName": "MusicCollection",
"Shards": [
{
"ShardId": "shardId-000000000000-eb21f0a24fbc56c3b158dc6ce671cff7",
"SequenceNumberRange": {
"StartingSequenceNumber": "49581060770287995596706525476998415239107935519832539138"
}
}
],
"StreamArn": "arn:aws:dynamodb:us-east-1:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19",
"KeySchema": [
{
"KeyType": "HASH",
"AttributeName": "Artist"
},
{
"KeyType": "RANGE",
"AttributeName": "SongTitle"
}
]
}
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-shard-iterator --stream-arn 'arn:aws:dynamodb:ddblocal:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19' --shard-id 'shardId-000000000000-eb21f0a24fbc56c3b158dc6ce671cff7' --shard-iterator-type LATEST
{
"ShardIterator": "AAAAAAAAAAEIVPCLPEb9tAXDWj/qEohQX+6KBTW21aJoF24VHUvE5y90dHZM50DiNfy+qLdAXQ6p0KqcitDcGHyWO5/gcp3r2xqZg60XIbj67pGTuLnVWF43FwSKkZeh22FSXEQwW6QSmto/Cb/7DzsQ6WRTbyZvmQ8AHEO5wGciehFNlvspVs6iIYGAbnuk3krHCj5KHc1zbVOSsUoOCSo4DP7qr/pe"
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-records --shard-iterator 'AAAAAAAAAAEIVPCLPEb9tAXDWj/qEohQX+6KBTW21aJoF24VHUvE5y90dHZM50DiNfy+qLdAXQ6p0KqcitDcGHyWO5/gcp3r2xqZg60XIbj67pGTuLnVWF43FwSKkZeh22FSXEQwW6QSmto/Cb/7DzsQ6WRTbyZvmQ8AHEO5wGciehFNlvspVs6iIYGAbnuk3krHCj5KHc1zbVOSsUoOCSo4DP7qr/pe'
{
"Records": []
}
aws --endpoint-url=http://localhost:4569 dynamodb scan --table-name MusicCollection
{
"Count": 2,
"Items": [
{
"SongTitle": {
"S": "Thriller"
},
"Artist": {
"S": "Michael Jackson"
}
},
{
"SongTitle": {
"S": "Purple Rain"
},
"Artist": {
"S": "Prince"
}
}
],
"ScannedCount": 2,
"ConsumedCapacity": null
}
aws --endpoint-url=http://localhost:4569 dynamodb put-item --table-name MusicCollection --item '{"Artist":{"S":"Lady Gaga"},"SongTitle":{"S":"Fame"}}'
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-shard-iterator --stream-arn 'arn:aws:dynamodb:ddblocal:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19' --shard-id 'shardId-000000000000-eb21f0a24fbc56c3b158dc6ce671cff7' --shard-iterator-type TRIM_HORIZON
{
"ShardIterator": "AAAAAAAAAAHaLv7De5qP8XYF1YzmX83Ag1dEd0MGkYfGKFd9EwIGLdqxGaSY7CVpyNJgiU/1gq5+xm/PAhQy8Rq8dtW2dfWm/KSAKDxpZTn+VVDE/Gmu2cT3epQpfv0cz0e5OyjbPcghGzjTsrmVhUv9A18WgHcjQRLX1xSUKKyqzFHBwGLf7ISdzqI8fF8W3lPuIiZt+kRXbsV12iGA/boIrJaWU1OM"
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-records --shard-iterator 'AAAAAAAAAAHaLv7De5qP8XYF1YzmX83Ag1dEd0MGkYfGKFd9EwIGLdqxGaSY7CVpyNJgiU/1gq5+xm/PAhQy8Rq8dtW2dfWm/KSAKDxpZTn+VVDE/Gmu2cT3epQpfv0cz0e5OyjbPcghGzjTsrmVhUv9A18WgHcjQRLX1xSUKKyqzFHBwGLf7ISdzqI8fF8W3lPuIiZt+kRXbsV12iGA/boIrJaWU1OM'
{
"Records": [
{
"eventID": "1",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"SongTitle": {
"S": "Purple Rain"
},
"Artist": {
"S": "Prince"
}
},
"NewImage": {
"SongTitle": {
"S": "Purple Rain"
},
"Artist": {
"S": "Prince"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "1",
"SizeBytes": 62
},
"awsRegion": "us-east-1",
"eventName": "INSERT",
"eventSource": "aws:dynamodb"
},
{
"eventID": "1",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"SongTitle": {
"S": "Thriller"
},
"Artist": {
"S": "Michael Jackson"
}
},
"NewImage": {
"SongTitle": {
"S": "Thriller"
},
"Artist": {
"S": "Michael Jackson"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "2",
"SizeBytes": 68
},
"awsRegion": "us-east-1",
"eventName": "INSERT",
"eventSource": "aws:dynamodb"
},
{
"eventID": "1",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"SongTitle": {
"S": "Fame"
},
"Artist": {
"S": "Lady Gaga"
}
},
"NewImage": {
"SongTitle": {
"S": "Fame"
},
"Artist": {
"S": "Lady Gaga"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "3",
"SizeBytes": 58
},
"awsRegion": "us-east-1",
"eventName": "INSERT",
"eventSource": "aws:dynamodb"
}
]
}
aws --endpoint-url=http://localhost:4569 dynamodb put-item --table-name MusicCollection --item '{"Artist":{"S":"Hoodie and the Blowfish"},"SongTitle":{"S":"Let her Fly"}}'
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-shard-iterator --stream-arn 'arn:aws:dynamodb:ddblocal:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19' --shard-id 'shardId-000000000000-eb21f0a24fbc56c3b158dc6ce671cff7' --shard-iterator-type LATEST
{
"ShardIterator": "AAAAAAAAAAFQK4F6p3oLOSNf2drZivuG4KjRss/QXXijsfdE0UMwVTPP1pzv5g4C1HRqcXu9s8uVMwuan/6s0zt9Kn+UYAqdgsBeouzkUt9FuuE7BYui5ZDj1zXqFJcW2HnZIUK01CJh/eNYXHVlZtsYf01mxWQgRjkImo84nzkAve1fHCpm7pPeX2kDt6f7a8qPSs3saJIi5lwp3MVEOlTMDVjlACrF"
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-records --shard-iterator 'AAAAAAAAAAFQK4F6p3oLOSNf2drZivuG4KjRss/QXXijsfdE0UMwVTPP1pzv5g4C1HRqcXu9s8uVMwuan/6s0zt9Kn+UYAqdgsBeouzkUt9FuuE7BYui5ZDj1zXqFJcW2HnZIUK01CJh/eNYXHVlZtsYf01mxWQgRjkImo84nzkAve1fHCpm7pPeX2kDt6f7a8qPSs3saJIi5lwp3MVEOlTMDVjlACrF'
{
"Records": []
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-shard-iterator --stream-arn 'arn:aws:dynamodb:ddblocal:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19' --shard-id 'shardId-000000000000-eb21f0a24fbc56c3b158dc6ce671cff7' --shard-iterator-type TRIM_HORIZON
{
"ShardIterator": "AAAAAAAAAAFqqopm3zxctxb1gUQr+ETcm1BgiT9/CaVi3eVqBn6dtH186OikDGMjQV+fcOuZWD7z008swRuwSanTsqxH8nstf17PiTff4ZhLRc2MJu55uDem5HdjezqBSThOzyeCUFzNoTwsjM6xxpmxzfL7iqw6m/yJj+KX7eS7XWglUz4rNsmKHIyOS7t9uLqgMt7udv47AVg+VEBtjp3AD+eQafIx"
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-records --shard-iterator 'AAAAAAAAAAFqqopm3zxctxb1gUQr+ETcm1BgiT9/CaVi3eVqBn6dtH186OikDGMjQV+fcOuZWD7z008swRuwSanTsqxH8nstf17PiTff4ZhLRc2MJu55uDem5HdjezqBSThOzyeCUFzNoTwsjM6xxpmxzfL7iqw6m/yJj+KX7eS7XWglUz4rNsmKHIyOS7t9uLqgMt7udv47AVg+VEBtjp3AD+eQafIx'
{
"Records": [
{
"eventID": "1",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"SongTitle": {
"S": "Purple Rain"
},
"Artist": {
"S": "Prince"
}
},
"NewImage": {
"SongTitle": {
"S": "Purple Rain"
},
"Artist": {
"S": "Prince"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "1",
"SizeBytes": 62
},
"awsRegion": "us-east-1",
"eventName": "INSERT",
"eventSource": "aws:dynamodb"
},
{
"eventID": "1",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"SongTitle": {
"S": "Thriller"
},
"Artist": {
"S": "Michael Jackson"
}
},
"NewImage": {
"SongTitle": {
"S": "Thriller"
},
"Artist": {
"S": "Michael Jackson"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "2",
"SizeBytes": 68
},
"awsRegion": "us-east-1",
"eventName": "INSERT",
"eventSource": "aws:dynamodb"
},
{
"eventID": "1",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"SongTitle": {
"S": "Fame"
},
"Artist": {
"S": "Lady Gaga"
}
},
"NewImage": {
"SongTitle": {
"S": "Fame"
},
"Artist": {
"S": "Lady Gaga"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "3",
"SizeBytes": 58
},
"awsRegion": "us-east-1",
"eventName": "INSERT",
"eventSource": "aws:dynamodb"
},
{
"eventID": "1",
"eventVersion": "1.0",
"dynamodb": {
"Keys": {
"SongTitle": {
"S": "Let her Fly"
},
"Artist": {
"S": "Hoodie and the Blowfish"
}
},
"NewImage": {
"SongTitle": {
"S": "Let her Fly"
},
"Artist": {
"S": "Hoodie and the Blowfish"
}
},
"StreamViewType": "NEW_AND_OLD_IMAGES",
"SequenceNumber": "4",
"SizeBytes": 79
},
"awsRegion": "us-east-1",
"eventName": "INSERT",
"eventSource": "aws:dynamodb"
}
]
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-shard-iterator --stream-arn 'arn:aws:dynamodb:ddblocal:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19' --shard-id 'shardId-000000000000-eb21f0a24fbc56c3b158dc6ce671cff7' --shard-iterator-type LATEST
{
"ShardIterator": "AAAAAAAAAAEQkyBM/tvuERuvqbtUSezRk6eAa9dWV3xWvP2HVZ3I7WdKKYhFswf9EjfVQOAtn//NENIlIzH6y+6buAEmgs3vDsR6PLYpt6Y4kcW3T6YjuhzCkK74hPjV1LLFKLhyq8lIg8qqr5NqewB7O7EWENBdiqTECdfaUuYvc/xOsOh+rSpJWb9SXkq4/lV+8/L6NX5BioVHIfFFnxHix3j8cCxY"
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-records --shard-iterator 'AAAAAAAAAAEQkyBM/tvuERuvqbtUSezRk6eAa9dWV3xWvP2HVZ3I7WdKKYhFswf9EjfVQOAtn//NENIlIzH6y+6buAEmgs3vDsR6PLYpt6Y4kcW3T6YjuhzCkK74hPjV1LLFKLhyq8lIg8qqr5NqewB7O7EWENBdiqTECdfaUuYvc/xOsOh+rSpJWb9SXkq4/lV+8/L6NX5BioVHIfFFnxHix3j8cCxY'
aws --endpoint-url=http://localhost:4570 dynamodbstreams describe-stream --stream-arn 'arn:aws:dynamodb:us-east-1:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19'
{
"StreamDescription": {
"StreamLabel": "TODO",
"StreamStatus": "ENABLED",
"TableName": "MusicCollection",
"Shards": [
{
"ShardId": "shardId-000000000000-eb21f0a24fbc56c3b158dc6ce671cff7",
"SequenceNumberRange": {
"StartingSequenceNumber": "49581060770287995596706525476998415239107935519832539138"
}
}
],
"StreamArn": "arn:aws:dynamodb:us-east-1:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19",
"KeySchema": [
{
"KeyType": "HASH",
"AttributeName": "Artist"
},
{
"KeyType": "RANGE",
"AttributeName": "SongTitle"
}
]
}
}
aws --endpoint-url=http://localhost:4570 dynamodbstreams get-shard-iterator --stream-arn 'arn:aws:dynamodb:ddblocal:000000000000:table/MusicCollection/stream/2018-01-24T06:26:19' --shard-id 'shardId-000000000000-eb21f0a24fbc56c3b158dc6ce671cff7' --shard-iterator-type AFTER_SEQUENCE_NUMBER --sequence-number 49581060770287995596706525476998415239107935519832539138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment