Is it possible to build Lightmass on a headless AWS EC2 instance?

I am trying to set up a CI/CD pipeline which hopefully builds the games lighting as a pipeline step. The build should take place on an EC2 instance on AWS through the command line.
The instance runs Windows Server 2022 with UE4 2.27.2 installed.

I haven’t been able to build the lighting on the remote instance yet.

the command I am using:

UE4Editor-Cmd.exe <uproject path> -run=resavepackages -buildlighting -quality=Preview -allowcommandletrendering -map=<map>

The initial problem was an error that popped up when building the lighting:

“a d3d11 compatible gpu is required to run the engine”

This error led me to finding the flag: -nullrhi

Adding this flag however, throws a new error:

LogWindows: Error: === Critical error: ===
LogWindows: Error:
LogWindows: Error: Assertion failed: RenderTarget [File:F:/UnrealEngine/UE_4.27.2_oc/Engine/Source/Runtime/Engine/Private/UserInterface/Canvas.cpp] [Line: 758]
LogWindows: Error:
LogWindows: Error:

I also get this error on my local PC, not just the remote instance. It seems that the -nullrhi flag doesn’t play well with the

I’m relatively new to UE4 so I’m unsure if what I am trying to do is even possible.
Is it possible to build Lightmass on a headless instance?
If so what flag or settings am I missing to enable this?

Some previous posts I found related to this that have been useful but haven’t solved my issues:

I’m happy to provide any additional info that could help! Thank for any help and pointers in advance