Last active
February 8, 2024 03:47
-
-
Save majindageta/c40718780e1fa43039f57b05d79f8757 to your computer and use it in GitHub Desktop.
Prerequisites: install JRE (like jre-8u221-macosx-x64) https://www.java.com/it/download/mac_download.jsp https://www.oracle.com/technetwork/java/javase/downloads/jdk13-downloads-5672538.html Download dynamoLocal: https://docs.aws.amazon.com/it_it/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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