AWS, Cloud Computing

3 Mins Read

Simplifying Large File Uploads to Amazon S3 with Presigned URLs

Voiced by Amazon Polly

Overview

In this blog article, we’ll look at using presigned URLs to upload big files to Amazon S3. Amazon API Gateway initially managed our file upload process, which can only handle files up to 10 MB. We’ve developed a method utilizing Amazon S3 presigned URLs to support larger files, enabling direct file uploads from the client interface without being constrained by Amazon API Gateway size restrictions.

Introduction

The 10MB payload size restriction for the Amazon API Gateway was set in response to user input and load testing conducted during the service launch. Although this limit cannot currently be configured, AWS may think about improving this capability in the future for users who need further restrictions. The Amazon API Gateway will accept a compressed payload supplied in less than 10MB. The Amazon API Gateway will automatically decompress the payload and may reject the request with an “Error 413 Request entity too large” if the uncompressed payload is larger than 10MB. One suggestion is using Amazon S3 for large file transfers to get around this limit. This may be done by having the Amazon API Gateway answer provide an Amazon S3 Pre-signed URL, which enables direct uploads to S3. With this method, uploads to Amazon S3, which supports multipart uploads and bigger file sizes up to 5TB, can be made without using the Amazon API Gateway’s 10MB limit.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

How to proceed?

To go ahead, it involves two main steps:

  1. Use an Amazon API Gateway to retrieve the presigned URL from Amazon S3 and set up a Lambda.
  2. Upload the file straight from the client using the URL you were given.

Benefits and Considerations

  • Scalability: Amazon S3 is designed to handle massive amounts of data and concurrent uploads, ensuring scalability for your application.
  • Reduced Latency: Direct uploads to Amazon S3 minimize latency by bypassing unnecessary intermediate steps.
  • Cost-Effectiveness: By offloading file uploads to Amazon S3, you can potentially reduce data transfer costs associated with Amazon API Gateway.

Process Architecture Diagram

AD

AWS Lambda Function to Generate Presigned URLS

Let’s start by examining the AWS Lambda function, which creates the presigned URL. Node.js will be utilized for the AWS Lambda function:

Uploading Client-Side using React

Let’s now talk about using this presigned URL to upload a file from the client side. Here, React is utilized:

CORS Configuration on Amazon S3

CORS failures are one frequent problem during implementation. Here’s how to set up CORS in the settings of your Amazon S3 bucket:

Conclusion

We can get around Amazon API Gateway’s restrictions on large file uploads by using Amazon S3 presigned URLs, which provides a safe and scalable alternative that can be used straight from client apps. This strategy protects your data while in transit and simplifies the process.

Drop a query if you have any questions regarding Amazon S3 presigned URLs and we will get back to you quickly.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training PartnerAWS Migration PartnerAWS Data and Analytics PartnerAWS DevOps Competency PartnerAmazon QuickSight Service Delivery PartnerAmazon EKS Service Delivery PartnerAWS Microsoft Workload PartnersAmazon EC2 Service Delivery Partner, and many more.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.

FAQs

1. How do I handle security concerns when using presigned URLs?

ANS: – Implementing appropriate access controls and expiration times when generating presigned URLs is crucial to prevent unauthorized access to Amazon S3 resources. Ensure that presigned URLs are securely generated and shared only with authorized users.

2. Can presigned URLs be used for other Amazon S3 operations besides uploads?

ANS: – Yes, presigned URLs can be generated for other Amazon S3 operations, such as downloading, copying, or deleting objects. They provide temporary access to perform specific actions on Amazon S3 objects within a limited timeframe.

WRITTEN BY Garima Pandey

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!