Let's explore how we can scale nodes manually and, later on, try to apply the same logic to our automated processes.
We're running the cluster in AWS which already has auto-scaling groups defined for both managers and workers. In such a setting, the most sensible way to scale the nodes is to change the desired capacity of those groups.
When new nodes are created by auto-scaling groups in Docker For AWS or Azure, they will join the cluster as managers or workers. If you choose not to use Docker For AWS or Azure, you'll have to do some additional work to replicate the same functionality as the one we're about to explore. You'll have to create init scripts that will find IP of one of the managers, retrieve join token, and, finally, execute docker swarm join command.