Skip to content

NASA-IMPACT/veda-url-shortener

Repository files navigation

------------------------------------------------------------------------------

URL Shortener service

Description

This is a simple URL shortener service built using FastAPI and AWS Lambda.

Deployment

To use this service, you need to have the following:

  • Python 3.12 or higher
  • OpenTFU installed and configured with your credentials

Once you have these prerequisites, you can deploy the service by running the following command:

tofu init 
tofu apply

This will create a new AWS Lambda function that handles the URL shortening logic. The API Gateway will be used to expose this function and make it accessible over the internet.

Usage

To use this service, you can send a GET request to the following endpoint:

curl -G --data-urlencode "url=<LONG_URL>" <API_URL>/service/link/shorten

This will return a shortened version of the long URL that can be used to access the original URL.

{
  "short_url": "<SHORT_URL_VERSION>",
  "long_url": "<LONG_URL>"
}

Or go to

<API_URL>/service/link/docs