(#3681, #3705) Fix an EC2 bug where EC2 jobs lost track of their instance ID during recovery.
(cherry picked from commit 07dc76653732061f566aa72f9e2ccabca3abcfcc)