FROM Debian
CMD apt-get install thing
CMD curl blabla/install.sh
Pretty much converts to:
aws-cli ec2 launch-instance
ssh user@server apt-get install thing
ssh user@server curl blabla/install.sh
In general, everytime you dispense of a high level abstraction, the solution is not to replicate the high level abstraction, but to build directly at a lower level abstraction.
If you want to replace burgers, just buy a slab of meat and put it in the fire or bake your own bread. You don't need to make preservants and buy artificial sweeteners, etc...
The way I solve that problem is by working directly on testing/staging servers which have the same specs as production.
I almost never run stuff on my local machine, and if I do it's a well isolated piece of code whose IO signature I know exactly and I can mock external systems with ease.