Script cost
Understand the pricing model and free tier for Cloud Code scripts.
Read time 2 minutesLast updated a day ago
Cloud Code has a free tier so that you can start developing and launch with it for free. You only start paying once your organization scales beyond the free tier or any applicable credit allowance. You can find more details and the pricing FAQ on the UGS product pricing overview page.
Cost calculations
Costs are calculated over three categories:Category | Description |
|---|---|
| Invocations | Invocations count the successful Cloud Code script execution requests within your organization. A successful execution covers any request that returns any response from the script with an HTTP 200 status code. |
| Compute hours | Compute hours are the seconds executing Cloud Code scripts within your organization. Executions can also include additional warm-up time. |
| Egress | Egress measures the size of responses (in GiB) from successful Cloud Code script executions within your organization. A successful execution covers any request that returns any response from the script with an HTTP 200 status code. |
Cost saving tips
Follow the tips below to reduce your cost using Cloud Code.- Ensure script responses only contain data that you use. Unused data contained in script responses still contributes to your egress costs.
- Ensure your Cloud Code scripts complete within the allotted 15 second timeout. An accidental loop can generate unexpected costs.
while(true) - Consider you can batch executions together. For example, Cloud Code script may depend on the response from
ScriptExampleB, calling these individually could cost double the amount compared to combining the logic of both into one script call.ScriptExampleA
Command batching
Command batching is a concept where each game action is a command that you can collect into a queue and send to the server in batches to process. For more information, refer to the Command batching page. For example, consider a game that distributes rewards after every action by callingCloud SaveEconomy- The first action results in 100 XP and 10 coins.
- The second action results in 50 XP and 5 coins.
- The third action results in 200 XP and 30 coins.