Upload html to S3 storage and deploy to netlify through/with serverless functions

Hey there!

I have a non-site related question. More of an idea-is-the-deployment-possible question.

I want to have a static website in which users can submit data. This data shall be processed on the client side and then inserted into an html page. (So far so accomplished)

The html page should then be uploaded and an email request sent to replace x.html with new-x.html. If approved the new-x.html shall be deployed in netlify. If possible I want to do that automatically/webhook.

I think the upload to an S3 instance should be possible. One could do an redirect to the new-x.html on the S3 (I saw the url shortener Project)

But how to automate the redirect? How to get the html from the S3 account to netlify?

Have you some hints or breadcrumbs I could follow? Is it even possible with serverless functions? (Maybe using a git commit through serverless?)

I’m new to git and the whole jamstack endeavor, so maybe I’m missing something bigtime!

Thank you for all your help

Not sure what exactly your idea or requirement is, but deploying to Netlify using the API is not very straightforward: Get started with the Netlify API | Netlify Docs

The key part being, you need to send a list of all current files along with their SHAs and include the new files. If you add only the new file, the deploy would have just that.

Instead, if you wish to deploy each file to a new site, that’s possible as well. You’d have to first create a new site using API and deploy to that.

Regarding that, it’s up to you. If it’s going to take a few seconds, you can use Netlify Functions. If it’s going to take longer, maybe Background Functions would help? If it’s going to take even longer, maybe you’d have to build the site on Netlify and do the file-fetching inside the build command.