The Difference between COGS and OPEX

COGS or OPEX? Look at what the cost does. Not whether it goes up with usage.

A reserved-instance commitment doesn't scale, and it's COGS. A salaried on-call engineer doesn't scale either, and that's COGS too. A marketing tool priced by usage scales all day long and it's still OPEX.

So ask what the cost is for. Is it

  1. delivering the product to paying customers today? That's COGS.
  2. building or improving the product? That's R&D, which is OPEX. If it qualifies, it gets capitalized onto the balance sheet instead (see Capitalized Software) and the amortization shows up in COGS in later years.
  3. selling, marketing or running the company? That's sales and marketing or G&A. Both OPEX.

Development cost is never COGS when you spend it. What gets into COGS from engineering is the people running production and, later on, the amortization of software you capitalized.

Where the usual engineering costs land

CostUsuallyNotes
Production hosting and cloudCOGSReserved capacity and committed spend for production count too.
Staging and dev environmentsR&D (OPEX)People get this one wrong a lot. Put it in COGS and your gross margin looks worse than it is.
CI/CD pipelines and build minutesR&D (OPEX)They build the product. They don't serve customers.
Observability for productionCOGSMonitoring and logging that keep the live service up. Tooling mostly developers use is R&D.
On-call and SRECOGSTime spent running production. Engineers building platform features are R&D.
Customer support and onboardingCOGSServing customers who already pay you.
Feature workR&D (OPEX) or capitalizedDepends on your company's capitalization policy.
Maintenance and bug fixesR&D (OPEX)Expensed when you spend it. Never capitalized.
Internal IT and employee toolsG&A (OPEX)Laptops above the capitalization threshold get depreciated.

When a cost could go either way, follow your company's policy and ask your controller. What matters is that you classify it the same way every quarter. Then when gross margin moves, it's because the business changed.