-
npm install
-
Create a DynamoDB table in AWS:
aws dynamodb create-table --table-name RouteCounts \ --attribute-definitions AttributeName=id,AttributeType=S \ --key-schema AttributeName=id,KeyType=HASH \ --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 \ --region us-east-1 \ --query TableDescription.TableArn --output text
-
Create a Lambda in AWS, using the
start
script:npm run start
-
Deploy the function code:
claudia update
-
Claudia will print the API Gateway URL. Set an environment variable and curl a few routes:
$ export BASE=https://waa2p41ame.execute-api.us-east-1.amazonaws.com/latest $ curl $BASE/foo {"id":"foo","count":1} $ curl $BASE/foo {"id":"foo","count":2} $ curl $BASE/bar {"id":"bar","count":1}
-
Delete the Lambda function and API Gateway resource:
claudia destroy
-
Delete the Dynamo table:
aws dynamodb delete-table --table-name RouteCounts --region us-east-1