
Building a Secure Serverless Upload Pattern on AWS with Terraform ๐
๐๐ถ๐ฟ๐ฒ๐ฐ๐ ๐๐ฝ๐น๐ผ๐ฎ๐ฑ๐. ๐ญ๐ฒ๐ฟ๐ผ ๐ฏ๐ฎ๐ฐ๐ธ๐ฒ๐ป๐ฑ ๐ฏ๐ผ๐๐๐น๐ฒ๐ป๐ฒ๐ฐ๐ธ๐. ๐๐ป๐๐ฒ๐ฟ๐ฝ๐ฟ๐ถ๐๐ฒ-๐ด๐ฟ๐ฎ๐ฑ๐ฒ ๐๐ฒ๐ฐ๐๐ฟ๐ถ๐๐. ๐ง ๐ ๐ฅ๐ฒ๐ฎ๐น-๐ช๐ผ๐ฟ๐น๐ฑ ๐ฃ๐ฟ๐ผ๐ฏ๐น๐ฒ๐บ (๐ง๐ต๐ฎ๐ ๐ ๐๐ฒ๐ฒ๐ฝ ๐ฆ๐ฒ๐ฒ๐ถ๐ป๐ด) A few weeks ago, I was reviewing a system where users were uploading files (some >300MB). The original flow looked โreasonableโ: Frontend uploads the file to the backend Backend processes the request Backend uploads the file to S3 Backend responds But in practice, the system was ๐ณ๐ฎ๐น๐น๐ถ๐ป๐ด ๐ฎ๐ฝ๐ฎ๐ฟ๐: โ Timeouts โ Lambda memory spikes โ High AWS bills โ Angry users And the root cause was always the same: ๐ง๐ต๐ฒ ๐ฏ๐ฎ๐ฐ๐ธ๐ฒ๐ป๐ฑ ๐๐ต๐ผ๐๐น๐ฑ ๐ก๐๐ฉ๐๐ฅ ๐ต๐ฎ๐ป๐ฑ๐น๐ฒ ๐ณ๐ถ๐น๐ฒ ๐๐ฝ๐น๐ผ๐ฎ๐ฑ๐ ๐ถ๐ป ๐ฎ ๐๐ฒ๐ฟ๐๐ฒ๐ฟ๐น๐ฒ๐๐ ๐ฎ๐ฟ๐ฐ๐ต๐ถ๐๐ฒ๐ฐ๐๐๐ฟ๐ฒ. ๐ก ๐ง๐ต๐ฒ ๐ฃ๐ฎ๐๐๐ฒ๐ฟ๐ป ๐ง๐ต๐ฎ๐ ๐๐ถ๐ ๐ฒ๐ ๐๐๐ฒ๐ฟ๐๐๐ต๐ถ๐ป๐ด The solution is a ๐๐ฒ๐น๐น-๐ธ๐ป๐ผ๐๐ป ๐ฏ๐๐ ๐ผ๐ณ๐๐ฒ๐ป ๐บ๐ถ๐๐๐๐ฒ๐ฑ ๐ฝ๐ฎ๐๐๐ฒ๐ฟ๐ป: ๐ ๐ฆ๐ฏ ๐ฃ๐ฟ๐ฒ๐๐ถ๐ด๐ป๐ฒ๐ฑ ๐จ๐ฅ๐๐ Instead of uploading files ๐ต๐ฉ๐ณ๐ฐ๐ถ๐จ๐ฉ your backend, you let the client upload ๐ฑ๐ถ๐ฟ๐ฒ๐ฐ๐๐น๐ ๐๐ผ ๐ฆ๐ฏ, but in a ๐ฐ๐ผ๐ป๐๐ฟ๐ผ๐น๐น๐ฒ๐ฑ, ๐๐ฒ๐บ๐ฝ๐ผ๐ฟ๐ฎ๐ฟ๐, ๐ฎ๐ป๐ฑ ๐๐ฒ๐ฐ๐๐ฟ๐ฒ ๐๐ฎ๐. This is the same pattern used by: โ Fintech platforms โ Healthcare systems โ Large SaaS products ๐งฉ ๐๐ผ๐ ๐๐ต๐ฒ ๐๐ฟ๐ฐ๐ต๐ถ๐๐ฒ๐ฐ๐๐๐ฟ๐ฒ ๐ช๐ผ๐ฟ๐ธ๐ ๐๐ถ๐ด๐ต-๐น๐ฒ๐๐ฒ๐น ๐ณ๐น๐ผ๐: 1๏ธโฃ Client asks pe
Continue reading on Dev.to
Opens in a new tab




