1

I cannot find definitive info on how much hosting a function (in C#) on Azure costs. Suppose I have nothing else running on azure, just a function that runs for 1 s and runs every hour and consumes only 1 MB of RAM (the first category is 128 MB as I have understood), how much costs that total including anything else I might need to make azure function run (the smallest consumption plan maybe?) per month? Are there soem monthly fix costs independently of usage? Is the total something below say $5/month? What alternatives do I have for $5 per month?

EDIT

Due to the lack of valuable replies I just thought I take the risk and I tried it out. After one day I am charged $0.01 for standard IO (sorry it's in German):

standard IO

I am not charged for the function itselt because it is less that the free grant. Can someone explain to me what storage (blob? files? tables? queues?) I am using when I am executing the following function? The function checks to see if a pdf is available for download by trying to download just the first byte of it.

public static void Run(TimerInfo myTimer, TraceWriter log)
{
  DateTime start = DateTime.Now;
  log.Info("-------------------------------------------");     
  log.Info($"C# Timer trigger function executed at: {start}");

  string[] urls = { "http://www.somewhere.com/foo.pdf", "http://www.somewhere.com/bar.pdf" };

  for (int i = 0; i < urls.Length; i++)
  {
    bool hasContent = HasWebPageContent(uri);
    string output = $"Exists {file} = {hasContent}";
    log.Info(output);
  }

  log.Info($"C# Timer trigger function execution ended and ran for {DateTime.Now.Subtract(start).TotalMilliseconds} ms.");
}

private static bool HasWebPageContent(string url)
{
  HttpWebRequest request;
  const int bytesToGet = 1;
  request = WebRequest.Create(url) as HttpWebRequest;
  var buffer = new char[bytesToGet];

  try
  {
    using (WebResponse response = request.GetResponse())
    {
      using (StreamReader sr = new StreamReader(response.GetResponseStream()))
      {
        sr.Read(buffer, 0, bytesToGet);
      }
    }
  }
  catch { return false; }

  return true;
}
8
  • Maybe you could choose a VM. When the VM is stopped, you only need pay for the storage account. May 1, 2017 at 8:51
  • I need a time triggered function, so stopping a VM is not possible.
    – David
    May 1, 2017 at 8:54
  • You could do it on Azure Runbook. Auto stop and start VM is possible. May 1, 2017 at 8:55
  • What service Plan do you select? May 1, 2017 at 8:55
  • I was thinking about Consumption Plan, but only if there is no cheaper (in total costs) option.
    – David
    May 1, 2017 at 8:57

3 Answers 3

2

The formula for Azure Functions cost per month is simple:

Memory Size X Execution Time x Executions/Mo

if Memory Size X Execution Time < 400,000 GB/s = Free

and

if Execution Time X Executions/Mo < 1,000,000 = Free

So for your particular case, 128MB x 1s x 1/Mo = Free

For $5 you can get memory as high as 1024MB, 1000s of execution time and run it more than 700 times a month.

Please refer to the Pricing Calculator to get a better estimate.

1
  • This is a LOT of execution time - a very good deal. If you're at 640Mb this is only $0.60! This is equivalent to 194 hours or 8 days of solid processing time. Functions won't be cost effective if you have many users doing this though. For fast running functions you can scale immensely very cheaply.
    – Simon
    Aug 21, 2018 at 20:50
2

Just for your information and without any warranty: After 20 days in a row running an Azure function every hour with an execution duration of 1 second I get charged $0.07 for storage consumption. As the chart shows and as expected I am within the monthly consumption plan free grant.

included storage

1

Azure Functions consumption plan is billed based on resource consumption and executions. Consumption plan pricing includes a monthly free grant of 1 million requests and 400,000 GB-s of resource consumption per month.

More information about consumption plan cost you could refer to this link.

Also, you could select free App Service Plan, you only need pay for storage account.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .