AWS IoT documentation says.
When a device goes offline, an app can still communicate with AWS IoT and the device's shadows. When the device reconnects, it receives the current state of its shadows so that it can update its state to match that of its shadows, and then publish a message with its updated state.
How not to retrieve data from the shadow if the device of offline?
or how to ignore outdated data from AWS IoT shadow?