7 Working with files

 

This chapter covers

  • Storing media files and other static content within serverless applications
  • Maintaining and accessing your files with your serverless API
  • Processing static files using your serverless function

In addition to requiring processing and database storage, applications often also need file storage for static files. Static files are media such as photos, audio or video files, and text files (for example, HTML, CSS, and JavaScript files).

Serverless applications need to store static files, too. Keeping your whole application serverless implies that you need a storage solution that follows the same principles. This chapter takes a dive into serverless file storage possibilities and examines how to create a separate file processing function that uses the storage and provides requested files to your other Lambda—your serverless API.

7.1 Storing static files in a serverless application

In the case of your pizza application, it wouldn’t be complete without the images of Aunt Maria’s delicious pizzas. Your cousin Michelangelo (also known as Mike) already took awesome photos of all the pizzas, so you just need to store and serve these static files. AWS has a service for that as well: the Simple Storage Service (S3), which allows you to store the files—up to 5 TB—in a serverless manner.

7.2 Generating thumbnails

7.2.1 Deploying your S3 function

7.3 Taste it!

7.3.1 Exercise

7.3.2 Solution

7.4 End of part 1: Special exercise

7.4.1 Advanced task

Summary