---
title: Migrating data from one bucket to another
description: Learn to migrate buckets between accounts and regions with the AWS CLI.
tags: object storage object-storage bucket migrate
dates:
  validation: 2025-09-02
  posted: 2018-09-14
---
import Requirements from '@macros/iam/requirements.mdx'

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- Installed and initialized the [AWS CLI for Scaleway](/object-storage/api-cli/object-storage-aws-cli/)
- An [Object Storage bucket](/object-storage/how-to/create-a-bucket/)

1. Create a new bucket.
    ```
    aws s3api create-bucket --bucket BUCKET-TARGET
    ```
2. Copy the objects between the Object Storage buckets using the [sync](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html) command.
    <Message type="important">
      If you have objects in the Scaleway `Glacier` storage class you must [restore](/object-storage/how-to/restore-an-object-from-glacier/) them before continuing.
    </Message>

    ```
    aws s3 sync s3://BUCKET-SOURCE  s3://BUCKET-TARGET
    ```
3. Check that the content of the copied objects matches the content of the source ones.
    ```
    aws s3 ls --recursive s3://BUCKET-SOURCE --summarize > bucket-contents-source.txt

    aws s3 ls --recursive s3://BUCKET-TARGET --summarize > bucket-contents-target.txt
    ```
4. Compare objects that are in the source and target buckets by using the outputs that are saved to files in the AWS CLI directory. See the following example output:
    ```
    aws s3 ls --recursive s3://DOC-EXAMPLE-BUCKET --summarize
    ```
    **Sample output:**
    ```
    2022-01-20 11:20:49      multiaz.png

      Total Objects: 1        Total Size: 18640
    ```
5. Update any existing applications or workloads so that they can use the target bucket name, and delete the source bucket.
    <Message type="important">
      Delete the old bucket once everything is copied to avoid additional charges. You can use the following command: `aws s3 rb s3://BUCKET-SOURCE --force`
    </Message>
