mjeffryes / url-shortener

example url-shortener service using aws lambda, api-gateway, dynamodb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Url Shortener

A serverless URL shortening service (think btly.com or tinyurl.com ) that runs on AWS.

This is a sample project demonstrating serverless deployment and testing. It is functional, but not fully-featured.

Architecture

Architecture Diagram

Deployment

This project uses a dev Docker image to package all its dependencies.

To build the lambdas run

  ./run steps/build

To deploy the full application run

  ./run steps/deploy

By default the application will be deployed using your default AWS profile. You may specify a different profile using an environment variable:

  AWS_PROFILE=my_profile ./run steps/deploy

Testing

Unittests may be run with

  ./run steps/test

For an integration test in AWS run

  ./run steps/integration

Usage/Examples

Shorten a URL:

  $ curl -v -H 'Content-Type: application/json' https://${API_HOSTNAME}/new --data-ascii '{ "url": "https://twitter.com" }'
  {"shortUrl":"https://<SERVICE_URL>/b190QQ"}

Follow a short URL:

  curl "https://<SERVICE_URL>/b190QQ

TODO

  1. Cloudfront for caching and easy name aliasing
  2. Friendly web UI for shortening URLS

About

example url-shortener service using aws lambda, api-gateway, dynamodb

License:MIT License


Languages

Language:TypeScript 52.5%Language:Go 18.8%Language:HCL 15.4%Language:Shell 5.5%Language:Dockerfile 5.1%Language:JavaScript 2.7%