https://github.com/truggeri/serverless-url-shortener
A serverless variation on the url shortener
https://github.com/truggeri/serverless-url-shortener
aws aws-application-composer ruby serverless
Last synced: about 1 month ago
JSON representation
A serverless variation on the url shortener
- Host: GitHub
- URL: https://github.com/truggeri/serverless-url-shortener
- Owner: truggeri
- License: mit
- Created: 2022-12-02T18:41:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-29T21:01:48.000Z (almost 3 years ago)
- Last Synced: 2025-01-09T06:29:46.780Z (over 1 year ago)
- Topics: aws, aws-application-composer, ruby, serverless
- Language: Ruby
- Homepage: https://short.truggeri.com
- Size: 388 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverless URL Shortener
This project is meant to be a simple URL shortener project using Aws serverless components.
## Architecture
This project makes use of three core Aws services, Api Gateway, Lambda and DynamoDB.

Api Gateway is used as the ingress from the internet. It routes requests to get, create and delete shorts. Those requests are routing using [the Lambda Proxy integration](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html) which allows us to handle request and response data in Lambda rather than at the Api Gateway level.
There are three Lambda functions which are written for the Ruby 2.7 runtime. Each Lambda handles input processing, database access and responses to the client.
Finally, our data store is Aws DynamoDB which is used to store the mapping from short to full url using a single table.
## Deployment
This project made use of [Aws Application Composer](https://aws.amazon.com/application-composer/) to author an [Aws SAM template](./template.yaml). This template can then be deployed with the [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html#install-sam-cli-instructions) with the following command,
```bash
sam deploy -t ./template.yaml --parameter-overrides JwtSecret=${JWT_SECRET} CertIdentifier=${CERT_ID}
```
### Configuration
There are two required config values,
| Name | Desc |
|---|---|
| JwtSecret | A value used to identify the deletion token |
| CertIdentifier | The id, not arn, of a certificate for the custom domain of the api |