How Can I Run Pixel Streaming on AWS EC2 for UE5 Without Paying When Idle?

Hi everyone,

I’m trying to set up Pixel Streaming for Unreal Engine 5 on AWS EC2, but I’m running into a concern with costs. Since EC2 instances are billed continuously while running, I want to make sure I only get charged for the time my project is actively running and not for idle periods.

Has anyone successfully managed to do Pixel Streaming in a way that avoids paying when the instance or project is idle? I’m mainly looking for guidance on how to handle this scenario efficiently, as I don’t want to incur unnecessary costs.

Any experiences, advice, or pointers would be really appreciated!

I can’t remember a specific example or tutorial to reference, but I will reemphasize the concept that you are probably aware of. The EC2 instance will be billed regardless of what is operating on it. The only way to save the money is to shut down the instance and only restart when you want to start streaming again.

What you might have setup up as the first proof of concept is the entire pixel streaming frontend living on the high powered Unreal instance. Users can get the URL or IP address for that machine and interact directly.

The better way to abstract that is similar to the “Matchmaker” example we’ve provided. There could be multiple Unreal instances available or there could be none, and the user only gets connected to one if it’s available.

So you will need to have some sort of lightweight access point that a user reaches first before getting passed onto a UE instance. That lightweight server would be a much cheaper EC2 instance compared to the GPU servers and it will hold the user until a GPU server is available. It would then communicate with EC2 to spin up a server for the waiting user.

It can take a couple minutes to start up an EC2 instance, so you have to accept that if you really want to cut costs you will be making your users wait.

I don’t fully know the specifics of what the best system architecture is for this. There are many ways to automate AWS tasks. If you have a lot of users you can get fancier by sharing the EC2 instance for multiple people or letting people take turns instead of every individual booting up an EC2 instance every time. There are also many services out there who will host your app and bill you by the minute just for the UE usage. This is much simpler to set up, but of course you and your company have to be okay with projects living on other people’s servers.

I also learned a bit about using a Lambda function to start and stop the instance based on when a user opens or closes the project, so that it doesn’t keep billing when it’s idle. But I’m still not sure how to set that up properly.
I also came across AWS S3,can that be used for Unreal Engine 5 Pixel Streaming as well?

I’m no AWS expert, but I believe Lambda is one helpful aspect of it.

Have you looked into Amazon GameLift Streams? It’s probably more expensive than managing your own EC2 resources, but then you don’t have to do so much management.

S3 is the storage service. Where it comes into play with pixel streaming is one potential use case where you have generic pixel streaming servers that can play multiple UE exe’s. These exe’s could be stored on S3 and downloaded only when needed so that every VM doesn’t need every exe installed at once.

1 Like