Can I run c ++ on aws elasticbeanstalk in php applications?

Ok, since the cloud is just a machine hosted remotely in regards to my knowledge, should not I be able to behave like a local server? I am using Windows 10, and my question is that I have written some programs in c ++ which I usually call in a PHP file through the exec () function:
so, for example, I save the program and place it in htdocs in the same folder, compile it and then PHP gets the data through the interface, makes a bit of logic and writes them to the text file and then executes the program c ++ as exec ("main"). exe "), c ++ reads the data in that text file and executes the final logic.How can I do this in a cloud service like aws? I used only there elastic beanstalk.