Upload files to AWS S3 Bucket from ESP

Hello All,

I am looking for an example code to upload files directly from ESP to S3 bucket (Files stored in SD card module, Say images and videos). I got PUT_OBJECT AWS API but is not building for ESP-IDF. Please help me out in this.

I have created S3 bucket as public but how do I access the API ??

Thanks in advance

Anyone here who could help me on this

Hello @Natasha , Yes I am using ESP-IDF.
I also dug into it and could find HTTPS PUT would work with certificates… But now am stuck with getting an image from SPIFFs to S3.
Could you please share the code if possible. It would be really really helpful.

Hi, @Aishwarya . We have demos for both uploading and downloading from s3 using coreHTTP, part of the AWS IoT device SDK for embedded C. There are also some docs. Links below.


1 Like

This may also help: coreHTTP Basic S3 Upload Demo - FreeRTOS

1 Like

To add to Dan’s response :
You may also look at the example in our FreeRTOS repository. This example uses coreHTTP library. Here is the exact demo location in the repository for S3 download. You can also checkout other demos in the parent folder. Please let us know if you have any questions.

1 Like

Thank you all,

I have gone through the codes and pretty much understood how it works.
I am planning to use This demo from aws-iot-device-sdk-embedded-C for my project.

Now I have an image in my SPIFFs and have to upload that image (Let’s say the image name is frame.png or frame.jpg). As per my understanding, the file to be uploaded is defined at

/* Pointer to the data to upload.*/
    #define DEMO_HTTP_UPLOAD_DATA    "Hello World!"

How do I set this to frame.jpg in my SPIFFs ??


@abhidixi @rtel @gooddan

I don’t want to use AWS FreeRTOS as core and just use POST requests to upload files to s3 bucket. I read that its very much possible and am trying to do the same but couldn’t succeed.

How do I POST images which are in SPIFFs partition ?
Please help me out of this. It would be great if you could provide an example.

coreHTTP library does not depend on FreeRTOS and can be used without it: GitHub - FreeRTOS/coreHTTP: Client implementation of a subset of HTTP 1.1 protocol designed for embedded devices.

You need the data you want to post in a buffer, so you probably need to read the image in a buffer. You can then pass the buffer to HTTPClient_Send just like here: FreeRTOS/S3DownloadHTTPExample.c at main · FreeRTOS/FreeRTOS · GitHub


Yes, I tried the same. But am getting errors while I try to add esp-spiffs library, As far as my knowledge this example doesn’t use ESP-IDF. How to make it work with ESP-IDF

I also tried getting this library as a component of ESP_IDF and make it work but failed in that too.

You are right that the example does not use ESP-IDF but there is no dependency of coreHTTP that should prevent you from using it with ESP-IDF. What are the errors that you are getting?

This seems more like a question for Espressif but if you share the errors you are getting, it will be easier to help.


At this time is this question just about integrating SPIFFS into your application? If so the title is misleading and I would suggest and as aggarg@ suggested it seems like a question for Espressif.

We can assist you here with posting to an S3 bucket, but SPIFFS is not required for that.

Do anyone did this please help me i want to send log file from spiffs to aws cloud with esp32 using presigned url, no an able to read spiffs file. please help me.

It seems that the question is related to SPIFFS. I’d suggest asking of Espressif forums.