Warning
You're browsing the documentation for an old version of Webiny. Consider upgrading your project to Webiny 5.40.x.
Architecture > API Architecture
File Download
Learn about the necessary cloud infrastructure resources on which the API project application relies on to download files.
What you’ll learn
- how file downloads are handled by the deployed cloud infrastructure and application code
Diagram
(click to enlarge)
For brevity, the diagram doesn’t include network-level cloud infrastructure resources, like region, VPC, availability zones, and so on. Check out the Default VPC and Custom VPC topics if you’re interested in that aspect of the deployed cloud infrastructure.
Description
The diagram shows what happens every time a client tries to download a binary file. The process consists of three steps:
- The client issues a GET
/download/{file-key}
HTTP request, which reaches the Amazon API GatewayB , which then invokes the File Manager’s Download Lambda functionC . - The Download Lambda function extracts the file key from the received HTTP request, and then fetches the file from the S3 bucket
C . - As a base64 encoded string, the file is returned to the Amazon API Gateway, which transforms it to an actual binary, and sends it back to the Amazon CloudFront.
- Amazon CloudFront receives the file, caches it, and sends it back to the client.
Visit the Working with binary media types for REST APIs article to learn more about how Amazon API Gateway deals with binary files.