I have checked most of the GCP services and Cloud Functions & Run are awesome, but they have limited runtime, also the App engine is designed for website hosting, not for temporary backend tasks.
so is there any service that supports my case, with serverless behavior where just pay for usage?
What do you mean by "limited runtime" ? With App Engine you might have some limitations in terms of languages it supports, but Cloud Run runs containers. What is your backend written in that you don't think it can support it?
A job lasting several days is something that cloud Run doesn't support at this time.
My suggestion to you would be to have a look at compute engine container OS. It allows you to specify a Docker container for a compute instance which you can start via an instance template. Once you've created a template, all you need to do is create a cloud scheduler task to start the instance with your container running and it will do the processing. You might have another function running on another schedule which checks for the completion of the job. If it's complete, then the function has permission to shut down that VM. It's a bit messy but it is a solution which you could automate if you wanted to. The starting of the task is much easier than monitoring for the end of it and shutting down the machine.
As someone mentioned, I'd use a Compute Engine to run the container to completion. I'd also consider Workflows to orchestrate the creation and shutdown of the Compute Engine.
Hi umar, I wrote a blog post showing how to run long-running containers using Workflows and GCE. It's not fully serverless but almost serverless with Workflows taking care of setup and teardown of GCE: