Spoke about AWS
Published a YouTube video
Published a podcast episode
+1

50. Building a File Transfer application on AWS - Live coding PART 3

https://youtu.be/hlW_RwRgskI

How can you build a WeTransfer or a Dropbox Transfer clone on AWS?

This is our third live coding stream. In this episode, we made our lambdas better by adding observability best practices (structured logs, metrics, and tracing) through Lambda Power Tools for TypeScript and Middy. We also created a simple Node.js CLI to easily upload files from the command line.

All our code is available in this repository: https://github.com/awsbites/weshare.click.

🔖 Chapters

00:00 Intro & Recap
01:40 Questions from the previous episode
02:37 Middy intro
08:43 Lambda PowerTools for TypeScript
12:10 Code recap and comments from the previous episode
14:54 Installing Middy and Lambda Power Tools
16:21 Adding Lambda Power tools to our share handler
18:05 Middifying the Lambda handler and connecting Lambda Power Tools
23:00 Logging some useful info using Lambda Power Tools
25:26 Adding custom metrics
26:55 Adding environment variables for Lambda Power tools
28:40 Updating our download Lambda as well
31:04 Deploying (and some more info about Power Tools Metrics)
32:15 EMF metrics deep dive
35:30 Deploying (DEBUGGING AND FIXING!) our project
40:00 Enabling tracing in serverless.yml
43:26 Fixing our Lambda exports
46:12 Seeing generated logs and metrics
48:00 Querying our logs with CloudWatch logs insights
53:05 Looking at our custom metrics in CloudWatch
54:20 Looking at (a blank canvas in) X-Ray for tracing
55:03 Adding the middy content-negotiation middleware and service JSON responses
01:07:00 Implementing a Node.js CLI for interacting with the Weshare APIs
01:09:20 Picking a Node.js CLI library (Commander.js and Yargs)
01:10:45 Updating package.json to expose our CLI script
01:11:50 Making the CLI script executable
01:12:45 Adding an alias for the executable in package.json
01:14:19 Scaffolding our CLI script using commander.js
01:18:23 Implementing our CLI business logic
01:19:53 Installing undici HTTP client
01:21:23 Reading and validating the filepath
01:27:00 Making HTTP requests with undici
01:36:42 Combining streams (HTTP request stream sending the content of files) 
01:42:30 Testing our CLI
01:44:28 Wrapping up

We set ourselves up for a challenge and in this series of live streams we will try to incrementally build a simple clone of WeTransfer or Dropbox Transfer that would allow us to upload files and share them by URL.

Everything is up for discussion (and your opinion is important!) but right now we are expecting to be using S3, Lambda, API Gateway, Route53, and tons of Node.js!

Come and join us on this awesome project! 🤩

All the episodes of this series:

- 🗒 Full playlist: https://www.youtube.com/watch?v=EfRElTYilyY&list=PLAWXFhe0N1vI1_z-06EzJ22pz95_gBrId
- PART 1: https://youtu.be/EfRElTYilyY (MVP with Lambda, API Gateway, and S3)
- PART 2: https://youtu.be/4wCX32YUtMk (Custom domain with Route53 and Content-Disposition)
- PART 3: https://youtu.be/hlW_RwRgskI (Observability best practices with Middy and Lambda Power Tools + CLI Application)
- PART 4: https://youtu.be/vVic3oqqqfY (Adding authentication using Cognito and implementing the OAuth 2 device flow)
- PART 5: https://youtu.be/0TzfkbisMEA (OAuth 2 device flow and DynamoDB Single Table Design)
- PART 6: https://youtu.be/b-FoqIcOcPw (Completing OAuth 2 device flow and Adding a login command to the CLI application)

#AWS #Middy #Serverless