There are two license options.
- network license (i.e. Flex, which sounds like what you're using)
- online licensing (enabled by a license server running hosted by MathWorks)
Run Flex either on-prem or in the cloud. On-prem will probably be a bit more challenging to get outside access to. In the cloud gives you more flexibility. In this case, however, I'd suggest always running a small, long-life instance. Don't bring it down; otherwise, you'll get your activation errors (if you don't use an EIP). Here a link to get you started (already includes the bits for installing and starting the Flex license manager)
I'm going to assume that since you're using Flex, you don't have an individual license, but in the event that you do as well, you can enable "logged in named user" on your license. Then, instruct MATLAB to start with the online license (i.e. matlab -licmode online). In turn, MATLAB will prompt you for your MathWorks Account (MWA) credentials. However, this alleviates ever needing to run a license server.
To make all of this a bit easier, you can use an AWS orchestration we've written for running MATLAB on AWS, using either of the two license models above.
This has MATLAB installed and ready to be started on either Linux (as of R2019b) or Windows (as of R2020b).
But there may be an even simpler way to do this. MATLAB Online with MATLAB Drive (for your file system).
MATLAB Drive provides cloud space to put files, which can be synced with your desktop machine. MATLAB Online allows you to run MATLAB in a browser (different than above, which is using an RDP/VNC session). Imagine writing your code locally, storing file/data to MATLAB Drive, then logging into MATLAB Online to run your code, which can also access MATLAB Drive. No network license required. This might be the best of all worlds.
Post back how things work out -- I'm sure others are equally interested in removing the license barriers to running MATLAB in the cloud.