Skip to content

apachex692/lad-s3-direct-transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning and Development: S3 Direct Transfer

This project demonstrates transfer of objects like images, videos, documents etc. directly to AWS S3 from client on browser without requiring the server to proxy the data transfer.

  • Author: Sakthi Santhosh
  • Created on: 30/12/2023

Prerequisites

Create a user in the IAM Console with the necessary policies to access S3, assign credentials to it and download the credentials.

Goal

The goal of this project is to reduce the load on the server while uploading objects like images, documents, videos etc. by allowing the client direct access to the storage, which is AWS S3 here.

Architecture

Following are the architectural diagrams and flow diagrams involved in this project.

Note: The Flask server can either be run locally or on AWS EC2. For this project, the server and the client are run locally. If run on server, there is no need to create a user in IAM Console and download the credentials. Instead, create a IAM Instance Profile for the EC2 Instance you're using.

Architecture Diagram for AWS

Old Flow Diagram

Old Flow Diagram

In this flow, the server has to upload the image to the S3 bucket before responding to the client's request. This blocks the server until the object is transferred to the bucket (if not handled asynchronously or multi-threaded), or increases the load on server.

Improved Flow Diagram

Improved Flow Diagram

In the improved flow, the image upload is taken care by the client. The server stores the metadata and returns a temporary upload link to the S3 Bucket.

Contributing

This is a learning and development project and I discourage submitting issues/pull requests. The repository has been kept public only for learning purpose.