How to deploy a Prefect 2.0 agent to a single VM as your execution layer?

Prerequisites

AWS EC2

GCP Google Compute Engine

Azure VM

How to ensure your agent gets restarted after VM gets shut down and rebooted?