Originally posted in reply to Hosting a minecraft event [Compute engine question] on Reddit
For brevity, I'm going to assume you've got the instance and all of your users in the us-central1 region, other regions may have slightly different prices and data transfer might be more expensive if some of your users are overseas.
Data transfer in on GCP is free, so you only need to worry about data transferred to the player. Googling around I see people reporting anywhere from 40 to 200 MB of data per hour per player. Assuming you have 300 players for 3 hours, 200 MB * 300 players * 3 hours = 180 GB data transfer out.
Internet egress from us-central1 is $0.12 per GB on the first 1TB of data, so $21.60 for 180GB, well within your free tier allowance.
The consensus on r/homelab seems to be 6-8GB of RAM should be enough.
CPU requirements are a bit less clear, but I'd be surprised if you need more than 4 CPU cores to run an unmodded server.
It looks like none of the predefined machine types have 4 VCPUs and 8 GB of memory, but you can configure a custom machine type to meet that requirement. The E2 standard machine type should be the right fit in terms of CPU power to price for a short term on-demand machine.
Custom E2 standard pricing (us-central1): $0.021811 per VCPU hour * 4 * 3 = $0.261732 $0.002923 per GB hour * 8 * 3 = $0.070152
You will also need to allocate disk storage for your instance. I doubt you'll need much space, but I/O performance scales with the size of the disk. I would go with an SSD persistent disk in that case, which is $0.170 per GB month, billed at second granularity. Assuming you allocate 20 GB of disk space and delete it immediately after the event (10800 seconds in 3 hours):
Seconds per month = 86400 * 30 = 2592000 ($0.170 / Seconds per month) * 10800 = $0.0007083
Adding it all up and rounding to the nearest penny:
Data egress: $ 21.60 E2 custom (4 VCPU, 8 GB): $ 0.33 Persistent SSD (20 GB): $ 0.01 Estimated Total (3 hours): $ 21.94
All of that said, you will likely need at least an hour or two to get the instance configured and might want to do a few test runs first. I'd expect to at least double that cost. You can setup the instance ahead of time then "stop" it, which will avoid paying $0.33/hr when it's not in use, but you will still be billed for the disk when the instance is stopped.
I should also point out that if you're inexperienced with running a minecraft server, it might be better to use a hosted service like Minecraft Realms to avoid running into issues and potentially having the server go down during your graduation ceremony. That would be sad. In my opinion, it's worth spending a few dollars on a professionally run server to avoid that.