Skip to content

melalj/lambda-url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Lambda function to shorten urls

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published