Skip to content

Instantly share code, notes, and snippets.

@majindageta
Last active February 8, 2024 03:47
Show Gist options
  • Save majindageta/c40718780e1fa43039f57b05d79f8757 to your computer and use it in GitHub Desktop.
Save majindageta/c40718780e1fa43039f57b05d79f8757 to your computer and use it in GitHub Desktop.
cd dynamoLocalDirectory
# run the java command
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
#don't close this terminal, open another window
#create the table using a json file
aws dynamodb create-table
--cli-input-json file:///Users/davidericci/Projects/meteosuper-api/localDynamo/create-forecastTable.json
--endpoint-url http://localhost:8000
#delete table
aws dynamodb delete-table --table-name meteosuper-forecasts-dev --endpoint-url http://localhost:8000
#scan table
aws dynamodb scan --table-name meteosuper-forecasts-dev --endpoint-url http://localhost:8000
#list tables
aws dynamodb list-tables --endpoint-url http://localhost:8000
#query
aws dynamodb query --table-name meteosuper-forecasts-dev
--endpoint-url http://localhost:8000
--key-condition-expression "PK = :pk"
--expression-attribute-values '{":pk":{"S":"3400737"}}'
#this is an example
{
"AttributeDefinitions": [
{
"AttributeName": "PK",
"AttributeType": "S"
},
{
"AttributeName": "SK",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "PK",
"KeyType": "HASH"
},
{
"AttributeName": "SK",
"KeyType": "RANGE"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 25,
"WriteCapacityUnits": 25
},
"TableName": "meteosuper-locations-dev"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment