GithubHelp home page GithubHelp logo

shorturl's Introduction

Implementation of URL Shortner with AWS Serverless Architecture

This repository contains code for creating short url generator with AWS Lambda and PostgresQL as database

Live Code - https://quwsootxp7c2yorf4ft6v3wpte0kjbsj.lambda-url.ap-south-1.on.aws/

Deployment Steps:

1: Create AWS Lambda Function with python 3.9 runtime with function url enabled

2: Download lambdaZip and import code into your lambda function

3: Create environment variable in lambda as follows:

DB_HOST = <db_host>
DB_NAME = <db_name>
DB_PASSWORD = <db_password>
DB_PORT = <db_port>
DB_USER = <db_user>
LAMBDA_URL = <lambda_url>

4: Attach Lambda Layer using below ARN: ( This will only work for ap-south-1 region ) - refer - KLayers for your region's layer ARN

jinja2 - arn:aws:lambda:ap-south-1:770693421928:layer:Klayers-p39-jinja2:4
psycopg2-binary - arn:aws:lambda:ap-south-1:770693421928:layer:Klayers-p39-psycopg2-binary:1

Jinja for template render

psycopg2 for PostgresQL Connection

5: In your database, create kLinks table as follows with SQL:

CREATE TABLE kLinks (
    original text NOT NULL,
    short text NOT NULL,
    PRIMARY KEY (original, short)
);

6: Make sure that your database is reachable using lambda and make sure your lambda function url is also public with no authenticaion, unless you are intention is doing so with authenticaion

shorturl's People

Contributors

not-qualified avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.