Skip to content

A serverless URL shortener using python/flask with DynamoDb as the data store

Notifications You must be signed in to change notification settings

weberon/elchapo

 
 

Repository files navigation

El Chapo

Setup

Create virtual environment

virtualenv venv

Activate virtual environment

source venv/bin/activate

Install dependencies

pip install -r requirements.txt

Deployment

Create an AWS account if you dont have one already and retrieve - public key and private key and then configure aws account on your terminal

aws configure

Refer to zappa_settings.json and change the parameters accoring to your application. You are now ready to deploy the application to staging and production.

zappa deploy <staging/production>

You can now configure your short url domain to route all requests to the URL that is given by zappa in the above step. If you have to update the application, run

zappa update <staging/production>

To delete the deployment run

zappa undeploy <staging/production>

Usage

Create a new shortened URL. The webhook paramater here is optional.

curl -XPOST '<short_url_domain>/c' -d '{
	"path": "shortpath",
	"webhook": "https://f81421ad32aa6b3f557cec14301e1296.m.pipedream.net?id=idtotrack",
	"redirect_url": "https://google.com"
}' -H "content-type: application/json"

Retrieve the original URL from the short url

curl '<short_url_domain>/shortpath'

Closing note

For more information regarding zappa and all the frameworks that it supports, please check out zappa

About

A serverless URL shortener using python/flask with DynamoDb as the data store

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%