This is a POC for a url shortening service using AWS APIGW, Lambda and DynamoDB
curl -X POST http://YOUR_ID.execute-api.eu-west-1.amazonaws.com/Prod/ --data "{ \"url\":\"https://github.com\"}"
curl -X GET http://YOUR_ID.execute-api.eu-west-1.amazonaws.com/Prod/{linkId}"
- Install aws-sam-cli
pip install aws-sam-cli
- Build the lambdas
./build_lambda.sh get_short_url
- Build the lambdas
./build_lambda.sh create_short_url
- Package the template
sam package --template-file template.yaml --s3-bucket YOUR_CFT_BUCKET --output-template-file packaged.yaml
YOUR_CFT_BUCKET can be a new empty bucket. - Deploy
aws cloudformation deploy --template-file /path/to/file/packaged.yaml --stack-name Url-Shortener-Stack --capabilities CAPABILITY_IAM
- Navigate to the AWS Console -> Api Gateway -> Your New Api (Url-Shortener)-> Root resource (/) -> Actions -> Deploy Api
- Voila!
- Install aws-sam-cli
pip install aws-sam-cli
- Install docker
- Build the lambda
./build_lambda.sh get_short_url
- Run sam
sam local start-api
- Run
./setup_local_dynamodb.sh
- Update the Lambda Environment(WIP)
You should have a new container running and listening on http://127.0.0.1:3000
This is an early stage WIP/MVP.