Skip to content

Latest commit

 

History

History

claudia

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Setup

  1. Install Claudia.js

  2. npm install

  3. 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
    
  4. Create a Lambda in AWS, using the start script:

    npm run start
    
  5. Deploy the function code:

    claudia update
    
  6. 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}    

Cleanup

  1. Delete the Lambda function and API Gateway resource:

    claudia destroy
    
  2. Delete the Dynamo table:

    aws dynamodb delete-table --table-name RouteCounts --region us-east-1