Creating a software-as-service company these days is easy and cheap. Code libraries and open-source projects for a company to piggyback on abound. Ready-to-use payment gateways are plentiful, and computing infrastructure is available from many public cloud providers.

One might think that with the lowering of startup costs, the playing field is level. Not quite so fast.

Read on to avoid some pain and walk through some lessons I've learned.

Related: The Downsides to Cloud Storage

Build to scale. For cloud-based companies, the back-end infrastructure is what counts. I am not bashing public clouds like Amazon Web Services, Rackspace or Microsoft's Azure, just to name a few, and not advocating that every company should build a private cloud for its needs (putting the company's hardware in a data center and being responsible for managing it).

Rather, executives should understand the type of business they have, how fast it's growing and their company's moment in its life cycle. 

Previously when I served as the head of operations for a public company, my staff and I built our whole compute infrastructure using a public cloud provider. It was a great way to start and keep down costs.

As the company grew, we could deploy more "compute instances" to handle the load and pay only for what we used. (An "instance" refers to the allocation of computer processing units, memory and storage that the public cloud provider reserves for customer use, much like how in the physical world more servers are deployed to handle a workload.)

There was no need to worry about purchasing hardware, connecting the different components of the network or fine-tuning the processing throughput. The biggest benefit of the public cloud is not having to worry about anything -- at least not initially.

Then we launched a new product that became hugely popular and the company's traffic spiked; thousands of new users signed up weekly. We had to deploy hundreds of new compute instances in the public cloud. We had to hire more people to manage the deployment of new instances, moving different instances across various zones and a ton of other things related to running and maintaining systems online.

When something crashes (as it will in a public cloud environment), someone has to be alerted to take action. What a company pays for in additional computing power to keep its business running can quickly skyrocket.

It’s not that a company can’t scale properly with use of a public cloud; it’s just that managers need to seriously consider the costs.

At my former company, we eventually decided to move everything to a private cloud. This meant adopting the traditional data-center model, in which we owned the hardware. The whole thing was configured to our specifications and we had better control. We saved millions of dollars annually and the improvement to our service was tremendous. We could finally handle the traffic increase without breaking the bank or inconveniencing the people we needed to support.

Related: 10 Questions to Ask When Choosing a Cloud Provider

A fable of three clouds. For understanding the different types of cloud operations, The Story of the Three Little Pigs offers an apt analogy. The first pig built its house from straw. The structure was constructed quickly, providing space and cover from the outdoors but pretty flimsy when the big bad wolf lurked nearby.

The same is true for most public-cloud deployments. If a company faces a huge increase in transactional compute power and needs to deploy multiple instances, the public cloud may fail and leave the firm running for help.

The second pig built its house from sticks, somewhat bigger and stronger than the straw one. That’s similar to the route taken by some companies after realizing that the public cloud may not be best or deciding that their firms have reached an inflection point such that they should build their own infrastructure. And so companies opt fo the data center available at the best cost, put in hardware and hope everything will be fine.

Since the second pig used better materials and a different strategy, it assumed it would not meet the same fate as the first pig. But it, too, failed to consider the project carefully enough and ultimately did not survive.

While having a private cloud might seem better initially, companies failing to take the proper precautions will meet the same fate as those using a public cloud -- or worse.

That’s why companies' constructing a really well-built private cloud is like the third pig's building a house of bricks. A well-planned deployment of a private cloud can save companies money and allow them to scale as needed.

This is the route that my current company, Axcient has taken. My staff and I decided we had to build a solid foundation, which meant spending time and money to create our own cloud infrastructure. This is not cheap, but we'll be able to scale, manage everything more easily and have complete control over the hardware, software and cloud orchestration. (We recently dhanged the way storage components interact with our servers and how our software talks to the back end, resulting in a fourfold increase in storage and a 66 percent plunge in power consumption. Such fine-tuning can’t be done with a public cloud.)

Some company managers are surprised to learn that public cloud infrastructures require a ton of work: Managers still must manage the different instances, constantly monitor and correct failures and hire people to care for the infrastructure. Small mom-and-pop shops or life-style businesses can be fine accessing a public cloud provider. But other companies need to carefully weigh the options. 

Cloud-based companies that scale fast may reach a point when their infrastructure won't be able to support them. Waiting too long to make a change could be fatal. Managers should realize sooner than later when it’s time to make a move.

Related: Making the Cloud Work for Your Business