My Profile Photo

Sam Battalio


Junior Computer Science Major at the University of Notre Dame


Chadpaste: Pastebin made alpha

This project started out as (hopefully you can tell by the site) as a joke.

My professor for Systems/Programming Challenges/OS has his own pastebin that he uses called yld.me. I thought it’d be funny to make my own file pastebin but with AWS architecture because I wanted to learn how to use AWS-Chalice, having only used Serverless or SAM before this.

The Site

The site is chadpaste. As you can see, my front end design skills are definitely lacking at the time of posting!

You can drag and drop an image and it will display on page. From there you can either open the image to the “raw” view or keep it. The link is kept to a 3 charater plus extension to make it work better for file sharing.

Architecture

Architecture

Hosting

Since I wanted to do everything in AWS, I figured the easiest path was to use a S3 bucket to host the site/images.

Then, I attached a cloudfront distribution in front of the s3 bucket to allow for ssl certs.

API

This was REALLY simple, but I might change it in the future. I decided to generate a presigned URL for POSTing directly to S3. This makes the user (front end) have to give two POST calls, which might not be amazing but it works.

With boto3, all I really had to do was create a lambda function that returned:

return {'url': boto3.client('s3').generate_presigned_url(........)}

In the near future I think I am going to make just one POST call to streamline the process and allow uploads easily from terminal w/ curl.

Source code

Here is the repo!