Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 1.31 KB

README.md

File metadata and controls

44 lines (34 loc) · 1.31 KB

Lambda Url shortener

Basic url shortener using AWS Lambda and DynamoDB (uses shortid for shortToken)

Inspiration from: Build a serverless URL shortener with AWS Lambda and API Gateway services

API endpoints

  • URL: POST /

    • apiKey required
    • Params type: json
    • Required Body Params: targetUrl
    • Optional Body Params: shortToken
    • Output: shortToken
  • URL: GET /:token

    • Params type: json
    • Required Path Params: token
    • Output: targetUrl

( need more documentation... PR welcome)

Get started

Requirements

Commands

# replace {{AWS_ACCOUNT_NUMBER}} first in api-swagger.yml and lambda/function/*/function.json with your aws account number
terraform apply
cd lambda && apex deploy

# you'll need to follow the instructions on https://github.com/awslabs/aws-apigateway-importer
aws-api-import -c ./api-swagger.yml

Test Commands

cd lambda
echo '{ "shortToken": "test", "targetUrl": "https://www.google.com/" }' | apex invoke post_token
echo '{ "shortToken": "test" }' | apex invoke lookup_token