reference · platform
Device Shadow: Desired vs Reported State in AWS and Azure
Understand desired, reported, delta, version, and freshness semantics across AWS IoT Device Shadows and Azure device twins without confusing state with proof.
Version, source checks, and technical review
- For
- Device Shadow: Desired vs Reported State in AWS and Azure
- Published
- Version
- See primary sources for versions
- Facts and sources
- Checked against the cited sources on Sep 4, 2026
- Technical review
- No independent technical review recorded
Conclusion first
The decision in one paragraph
A device shadow is a coordination model for desired and reported state; it is not proof that a physical action completed.
The short answer
A device shadow is a coordination model for desired and reported state; it is not proof that a physical action completed.
A device shadow is a service-side representation used to coordinate state with a device that may be offline. Most implementations separate desired state—the target requested by an application—from reported state—the latest state reported by the device. The difference can drive reconciliation when the device reconnects. Because products and cloud services implement shadows differently, the exact update, merge, version, and deletion semantics are part of the platform contract.
Why shadows exist
Applications need a stable API even when a device is asleep or disconnected. Without a shadow, every screen and workflow must handle a live device session directly. A shadow lets an application record intent, display the last reported state with its age, and allow the device to reconcile later.
This is useful for configuration such as reporting interval, display brightness, or a non-urgent mode. It becomes dangerous when a product presents desired state as physical truth or replays an old action after circumstances changed.
How it works
An application writes a desired-state update with a version or conditional token. The service stores it and notifies the device when possible. The device evaluates whether the change is valid, applies it, and updates reported state. The service can calculate a delta between desired and reported values.
Different writers own different fields. The platform may own policy targets, while the device owns measured or applied state. If both sides can write the same field without a precedence rule, updates race and oscillate. Version numbers, timestamps, and compare-and-set behavior help detect stale writes, but only when clients use them.
Partial document updates require careful semantics. A missing property may mean “unchanged,” “unknown,” or “delete this property.” Arrays may replace as a whole. Null may trigger deletion in one service and represent a real value in another. Model these rules explicitly instead of treating the shadow as a generic JSON bucket.
Connectivity and freshness are separate from state. A reported value from yesterday may be syntactically valid but operationally useless. Store source time, receipt time, device boot or sequence context, and the last confirmed reconciliation. A user interface should display “requested,” “reported,” “offline,” and “unknown” distinctly.
Vendor-neutral model vs AWS and Azure
“Device shadow” is a useful generic term, but implementation details are not portable by name alone. AWS IoT Core calls the stored representation a Device Shadow; Azure IoT Hub uses device twins. Both separate service-written desired properties from device-written reported properties, yet their document layout, metadata, update APIs, concurrency controls, and fleet features differ.
| Concern | Vendor-neutral requirement | AWS IoT Device Shadow | Azure IoT Hub device twin |
|---|---|---|---|
| Target state | A clearly owned desired value | state.desired |
properties.desired |
| Observed/applied state | A device-owned reported value | state.reported |
properties.reported |
| Difference | A reconciliation input, never physical proof | Service calculates delta |
Application/device reconciliation logic compares desired and reported properties |
| Concurrency | Reject or reconcile stale writers | Shadow document version increments on updates |
ETag supports optimistic concurrency; desired properties also carry $version |
| Deletion/update | Specify patch, replace, null, array, and missing-field semantics | Shadow update document semantics apply | Twin patch/replace APIs and null removal semantics apply |
| Fleet use | Define targeting, rollout, and status evidence separately | Named/classic shadows and fleet features have distinct behavior | Tags, queries, configurations, and reported status support fleet management |
Treat this table as a mapping checklist, not an API compatibility promise. Before migration, test nested objects, arrays, null, deletion, concurrent updates, version mismatch, offline delivery, limits, and authorization against the exact service version.
Reconciliation states and transitions
A safe implementation needs more than desired and reported JSON. Model at least these states:
- Requested — a writer records desired state with identity, version, creation time, expiry, and reason.
- Pending delivery — the device has not acknowledged the relevant version; connectivity is separate metadata.
- Evaluating — the device checks schema, local mode, authorization context, and safety preconditions.
- Applied — software accepted the change and reports the version and result.
- Verified — independent evidence confirms the intended physical or operational outcome when that proof is required.
- Rejected, expired, or uncertain — the system preserves the reason and does not silently retry forever.
Reported state may move the record to “applied,” but it should move to “verified” only when the use case has suitable evidence. A thermostat echoing a target is not proof that room temperature changed; a controller echoing a valve request is not proof of flow.
Security and authority boundary
Authorize desired-state writers by tenant, device group, field, and operation. The service API must not let a convenient application credential rewrite every field. Devices should validate the requested schema and bounds again, and safety-critical controllers must retain independent interlocks.
Bind a request to the intended device identity and lifecycle. Factory reset, ownership transfer, replacement hardware, identifier reuse, or rollback can make stored desired state unsafe. Define whether desired state is cleared, migrated, quarantined, or explicitly re-approved at each transition.
For a design procedure, use How to Design a Device Shadow. It turns these semantics into field ownership, versioning, expiry, reconciliation, and verification decisions.
What a shadow solves
A shadow decouples applications from moment-to-moment connectivity, provides a current coordination record, and supports eventual reconciliation. It can reduce direct command retries for state that remains meaningful over time.
It also gives multiple applications a controlled place to read current intent and observation. With versioning and field ownership, that can be safer than each service maintaining a private cache.
What it does not solve
A shadow is not a command queue, event history, or audit log. Overwriting a desired value can erase the sequence of intent. A reported value proves only what the device claimed; it may not prove a relay moved, a valve opened, or a room reached temperature.
It does not decide whether stale intent should still be applied. Commands such as “unlock,” “dispense,” or “start motor” usually need expiry, authorization, preconditions, and one-time outcome tracking rather than an eventually convergent property.
Where it fits—and where it does not
Use shadows for durable, reconcilable configuration and state whose convergence remains safe after delay. Avoid them for safety interlocks, financial actions, one-time operations, or rapidly changing telemetry. High-rate measurements belong in a stream or time-series system, not a continually overwritten document.
Define maximum acceptable staleness per field. Specify what happens after factory reset, device replacement, ownership transfer, firmware downgrade, and schema migration. A new device should not inherit unsafe desired state merely because it reused an identifier.
Related technologies
MQTT can transport shadow notifications, but MQTT does not define desired or reported state. Digital twins may combine state with richer models and decision context. Event logs preserve history. Command systems track requested actions and outcomes. Thing models can define property type, units, mutability, and authority.
Common misconceptions
“The shadow is the device” encourages stale-state bugs. “Desired equals pending command” ignores whether the intent remains valid. “Last write wins is conflict resolution” silently discards concurrent decisions. “Reported means verified” trusts software without physical evidence. “One giant shadow is simpler” creates unrelated writers and excessive contention.
Keep shadows small, typed, versioned, and honest about uncertainty. If a field cannot have a clear owner and reconciliation rule, it probably does not belong there.
Before you ship
Implementation checklist
- Use shadows only for state with clear reconciliation rules.
- Attach timestamps and version tokens.
- Keep safety-critical control outside ambiguous convergence.
Primary sources
Verify the facts
- AWS IoT Device Shadow serviceAccessed Sep 4, 2026
- Azure IoT Hub device twinsAccessed Sep 4, 2026
Sources checked Sep 4, 2026 · Next check due: March 20, 2027
Maintenance
Update history
- Jul 14, 2026
- First published
- Sep 4, 2026
- Content updated and sources checked
Tell us when an explanation is unclear, inaccurate, or outdated.