No matter what you do, you can't 100% control clients cache and hence some will continue to use the old IP address for "some" time.
Which means, your service needs to continue to exist to the old address for "some" time. How long? In theory, the delay of your current TTL on
A record, but it is never a problem to wait more than that and it is strongly recommended (if you are into scheduled planned changes, you can plan for proper cool off periods to transition smoothly).
If you ensure both IP addresses work during the transition, you avoid lots of problems.
For a quicker transition, you can at the DNS level:
- lower the current TTL value on the
A record (anywhere your old IP address appear), without going lower than
300 or so
- from the moment you see the change live on all authoritative nameservers, wait for the previous TTL time
- now, normally, all clients asking for the IP address get it with the new reduced TTL but still with old IP address, that is the expected goal there
- do your zone content change to use the new IP address
- from the moment you see the change live on all authoritative nameservers, wait for the current TTL time before even thinking about shutting down the traffic reaching the old IP address.
- at the end you can change again the TTL to some higher values (consult your DNS provider and webhosting company); anything around a couple of hours/a couple of days is pretty standard (and contrary to popular belief just using the lowest possible one is not always a good idea and never without drawbacks: high TTLs help you battle against DoS or other problems on the DNS servers)