Serverless File Uploads using S3 and Lambda
Why Stack Overflow recommends it
Stack Overflow users link it as the reference tutorial for presigned-URL S3 uploads, both as the setup they followed in debugging questions and as the recommended alternative to embedding AWS keys in client apps.
Recommended by 1 people across 1 different months, 2021 to 2024.
What it is
A short AWS demo walkthrough of uploading files directly to Amazon S3 using presigned URLs generated by a Lambda function, so the application itself does not handle upload bandwidth or compute. It is part of a series on the S3-to-Lambda serverless pattern, with code in a GitHub repo, and the approach works for non-serverless web apps too.
What people said
Recommends Tom McLellan · 2024-01 · Stack Overflow · on “AWS S3 Access and Secret Key management in React Native”
Deactivate your access key and check for unauthorized access immediately . If your app has been published already, you might want to close your AWS account and open a new account - it may be simpler than auditing for unauthorized access. It's easy enough for anyone (or a script) to download and parse the contents of your app in search of secrets and take over your AWS account. You want to assume that anything published in your React Native app is about as secure as publishing it on a website that you've promoted on social media. For S3 file uploads from your app, you'll want to have a server-side function (your own server or a serverless function on AWS) that authenticates the user and gener
Cites Notorious776 · 2021-06 · Stack Overflow · on “Error when uploading to S3 bucket using Presigned URL”
I followed this AWS tutorial [this video] to create a bucket and a Lambda function that makes a request for a Presigned URL from S3. I also created an IAM role that has read/write permissions. I then created an API Gateway so I can call an endpoint. I then followed this [LINK] tutorial to create a quick front-end in React. Its a simple drag/drop application that uses my API endpoint to get the Presigned URL. This is what my React component looks like: import React, { useCallback } from "react"; import { useDropzone } from "react-dropzone"; import axios from "axios"; import { API_ENDPOINT } from "./aws_config"; export function Test3() { const onDrop = useCallback((acceptedFiles) => { var file = ac
Cites Pablo · 2021-07 · Stack Overflow · on “Error using presigned URL for uploading data from Blazor WASM app to AWS S3 bucket”
I have followed and then modified the code given in the following sources Lambda code [LINK] Front end code [LINK] CORS [LINK] General walkthrough [this video] But when I try and upload an image using the code below... public void UploadObject(Stream jpeg_image) { var buffer = new byte[8000]; HttpWebRequest httpRequest = WebRequest.Create(URL) as HttpWebRequest; httpRequest.Method = "PUT"; using (Stream dataStream = httpRequest.GetRequestStream()) { int bytesRead = 0; while ((bytesRead = jpeg_image.Read(buffer, 0, buffer.Length)) > 0) { dataStream.Write(buffer, 0, bytesRead); } } HttpWebResponse response = httpRequest.GetResponse() as HttpWebResponse; } I get hit with the following error from the