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
-
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
- Params type:
( need more documentation... PR welcome)
# 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
cd lambda
echo '{ "shortToken": "test", "targetUrl": "https://www.google.com/" }' | apex invoke post_token
echo '{ "shortToken": "test" }' | apex invoke lookup_token