Book a free call

How to Keep Data Safe and Accurate During Cloud Migration

Data can be changed or lost in transit during a cloud migration, and exposed by weak controls in its new home. Here is how to check integrity and lock down security.

Hertiv engineering teamReviewed by a senior engineer
8 min read
How to Keep Data Safe and Accurate During Cloud Migration
On this page

Short answer

Data integrity during cloud migration means every record arrives complete, unchanged and in the right place, while security means only authorised people and systems can read or change it along the way. You protect both with checks that compare source and target, encryption in transit and at rest, tight access controls, and an audit trail that records every step.

What is data integrity and security during cloud migration?

Data integrity during cloud migration means every record arrives in the new cloud complete, unchanged and in the right place, while security means only authorised people and systems can read or change the data on the way there. The two go together: a move that is fast but unchecked can silently lose or alter records, and a move that is checked but open can expose customer data.

Integrity is about sameness. If the source holds 2 million customer rows, the target must hold the same 2 million rows, with the same values, the same dates and the same relationships between tables. Security is about control: who can see the data, who can change it, and what is recorded about each access.

Most migrations need both from the first planning meeting, not as a final check. A migration plan that treats integrity and security as separate jobs usually finds problems after cutover, when the old system is already switched off. For the wider planning picture, see what cloud migration involves.

What can go wrong with data during a migration?

Data can go wrong in a migration in quiet ways that no error message flags. The most common failures are small changes that only show up weeks later, when a report totals differently or a customer record is missing a field.

  • Dropped rows. A filter, a failed batch or a timeout leaves some rows behind while the rest of the load reports success.
  • Truncated or changed values. A text field cut to a shorter length, a date converted to a different format, or a decimal rounded by a type change.
  • Duplicate rows. A retry after a partial failure loads the same batch twice.
  • Broken links between tables. Orders arrive but the customer records they point to do not, leaving orphaned rows.
  • Changed ordering or encoding. Special characters turn into replacement symbols, and sorted data arrives in a different order.

Security failures are quieter still. Data copied over a public connection, a shared password for the migration account, or a storage bucket left open during the move can expose records without anyone noticing until an audit or a breach report.

How do you prove the data survived the move intact?

You prove the data survived the move by comparing the source and the target with checks that run before, during and after the transfer, and by refusing to switch over until the checks pass.

CheckWhat it catchesWhen to run it
Row countsMissing or extra rowsAfter each load
Checksums or hashesChanged values in a file or tableBefore and after transfer
Spot-value comparisonTruncation and type changesAfter each load
Key and link checksOrphaned or broken referencesBefore cutover
Sampled full-record checksErrors the counts missBefore cutover

A checksum is the strongest single check: hash each file or table at the source, hash it again at the target, and compare. If the hashes match, the content is identical. Row counts alone are not enough, because a changed value does not change the count.

Run a small sample check on full records as well, comparing every field of a few thousand randomly chosen rows. Counts and hashes prove the bulk is right; the sample proves the detail is right. A cloud data migration strategy normally sets these checks as gates that must pass before the next stage starts.

How do you protect data while it travels?

You protect data in transit by encrypting the connection, keeping the transfer off public networks where possible, and making sure only the migration tools can reach the endpoints.

Use encrypted connections for every hop: TLS for transfers over the internet, and a private link or VPN tunnel when the cloud provider offers one. A private link keeps the traffic inside the provider network instead of crossing the public internet, which removes a whole class of interception risk.

Do not move data through shared or personal accounts, and do not leave the source or target storage open to the internet during the move. Give the migration job its own credentials with access to exactly the buckets and tables it needs, and set those credentials to expire when the migration ends.

Keep the transfer window short and watched. A long, unattended copy gives an attacker more time and makes it harder to tell which records moved when. For the wider set of risks to plan for, see cloud security risks and solutions.

How do you protect data once it lands in the cloud?

You protect data at rest in the new cloud with encryption, tight access rules and backups that are tested before you need them.

Turn on encryption at rest for every store that holds migrated data: databases, object storage, backups and search indexes. Use keys managed by the cloud provider or your own key service, and keep the keys separate from the data so that a stolen copy of the data alone is unreadable.

Apply the same access rules in the new cloud that the data had before, and check them rather than assuming they carried over. A common failure is a storage bucket that is readable by anyone in the account because the migration tool created it with default permissions.

Set up logging for the new stores from day one, so every read and write is recorded. Take a backup of the migrated data as soon as the checks pass, and test that the backup restores. A backup you have never restored is a hope, not a safety net.

Who should be able to touch the data during a migration?

Only the people and tools that need access for a specific migration task should be able to touch the data, and only for as long as the task lasts.

Give the migration a dedicated account with the narrowest permissions that fit the job: read from the source, write to the target, nothing else. Avoid reusing a shared admin account, because then the audit trail cannot tell who did what, and a leaked password opens everything.

Separate the duties. The person who approves the cutover should not be the same person who ran the load, and the person who holds the encryption keys should not be the one who can export the data. Separation means one mistake or one compromised account cannot silently change the data.

Record every access during the migration and review the log before cutover. If the log shows an unexpected read or a login from an unusual place, stop and investigate. Good data security and compliance practice is to treat the migration log as evidence, not as a formality.

How to run an integrity and security check, step by step

You run an integrity and security check as a short, repeatable sequence that happens before cutover, not as a single look at the end.

  1. Record the baseline. Count the rows in every table and hash every file at the source, and store the results where the migration team can compare them later.
  2. Check the transfer path. Confirm the connection is encrypted, the endpoints are private, and the migration credentials work and nothing else does.
  3. Load in stages. Move one table or file at a time, and check counts and hashes after each stage instead of waiting for the whole load.
  4. Compare spot values. Pick a random sample of rows and compare every field between source and target.
  5. Test the links. Check that foreign keys and references still resolve, and that no orphaned rows exist.
  6. Review access and logs. Confirm who touched the data, revoke the migration credentials, and only then approve cutover.

If any check fails, fix the cause and re-run that stage. Do not approve cutover with a known mismatch and a plan to fix it later, because after cutover the source may be switched off and the evidence gone.

Example (hypothetical): a retailer moves its order history

Example (hypothetical): a retailer moves 2,400,000 order rows from an on-premise database to a cloud warehouse. The data is split into 12 files of 200,000 rows each, and the team hashes every file before the transfer.

After the load, the target shows 2,399,988 rows, which is 12 rows short of 2,400,000. The hash check shows 11 of the 12 files match, and one file does not. The team finds that a date filter dropped 12 rows from that file during export, fixes the filter, and re-transfers the single file of 200,000 rows.

After the re-run, the target shows 2,400,000 rows and all 12 hashes match. The team then samples 5,000 rows and compares every field, finding no differences. The copy took 3 hours 20 minutes inside a planned 4-hour window, leaving 40 minutes for the checks before cutover.

What are the common mistakes?

The most common mistakes in a cloud migration are skipping the checks, trusting defaults, and treating security as a task for after the move.

  • Checking only row counts. Counts miss changed values, so a migration can pass the count and still hold wrong data.
  • Trusting default permissions. New cloud stores often start more open than the old system, and nobody notices until an audit.
  • Using shared or permanent credentials. A shared admin account makes the audit trail useless and the blast radius large.
  • No rollback plan. Without a tested way back, a failed cutover becomes a long outage instead of a short delay.
  • Skipping the backup test. A backup that has never been restored may not restore when it matters.
  • Cutting over with known mismatches. Small differences found late are usually real problems, not rounding.

Key takeaways

  • Integrity means the target matches the source row for row and value for value
  • Checksums and row counts together catch both missing rows and changed values
  • Encrypt data in transit and at rest, and keep the keys separate from the data
  • Give the migration its own narrow credentials and revoke them after cutover
  • Never cut over with a known mismatch, even a small one

Frequently asked questions

What is data integrity in a cloud migration?

Data integrity means the data in the new cloud is identical to the data in the old system: the same rows, the same values and the same links between tables. It is checked with row counts, checksums and sampled record comparisons before the old system is switched off.

How do checksums prove data was not changed?

A checksum or hash is a short value computed from the contents of a file or table. If even one character changes, the hash changes. Hashing the data at the source and again at the target and comparing the two values proves the content is identical.

Should data be encrypted during migration?

Yes. Use encrypted connections such as TLS for every transfer, and a private link or VPN tunnel when the provider offers one. Encryption in transit protects the data while it moves, and encryption at rest protects it once it lands in the new cloud.

Who should have access during a migration?

Only the people and tools with a specific migration task, and only for as long as that task lasts. Use a dedicated migration account with narrow permissions, separate the approval role from the loading role, and revoke the credentials after cutover.

What should you do if the checks find a mismatch?

Stop and find the cause before cutover. Re-run the affected stage after fixing the filter, mapping or export that caused it, then re-check. Approving cutover with a known mismatch risks losing the source data before the problem is understood.

How long should you keep the old system after migration?

Keep it until the integrity checks pass, the security controls are verified, and the new system has run normally for an agreed period. Keep a tested backup of the migrated data as well, so a problem found later does not mean starting over.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: software products in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning a cloud migration and worried about your data? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Cloud Services service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call