Cloud providers do not have much unused resource. Tricks like spot instances make sure that they are as close to 100% utilization as possible while still being able to handle a spike in demand.
Do you mean that the cloud provider can write off that income as charitable donation?
If a business allows a nonprofit to use excess capacity, the capacity is still a business expense.
Google and AWS have huge amounts of unused computer capacity at low traffic periods. They can still expense those items even if they allow charitable use when not needed for business use.
Worst case if no unused capacity a business can call the expense a marketing expense and can ask the nonprofit to acknowledge their support of the activity. This is not uncommon.