There were three servers under an application load balancer (ALB) that needed to be vertically scaled by our devops team. These servers were responsible for routing traffic to the website.
Servers were going to be upgraded one at a time: provisioning a new instance, adding them to the ALB; and pulling out the older one (leaving them alive long enough for connections to naturally close).
However, there were some 502s with this approach because as soon as instances were added to the ALB they received traffic while they were initializing and not really ready for it.
To avoid this, you could wait for a warmup period long enough to ensure the server is ready or set them to slow start mode.