<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Syprose Gwako on Medium]]></title>
        <description><![CDATA[Stories by Syprose Gwako on Medium]]></description>
        <link>https://medium.com/@syprosegwako?source=rss-1db2a765d15c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*khFOf1woOTvO_9a43a0pAg.jpeg</url>
            <title>Stories by Syprose Gwako on Medium</title>
            <link>https://medium.com/@syprosegwako?source=rss-1db2a765d15c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 10:12:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@syprosegwako/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Moving Firestore Data between Different Projects (GCP)]]></title>
            <link>https://syprosegwako.medium.com/moving-firestore-data-between-different-projects-gcp-d7e0f178cf23?source=rss-1db2a765d15c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7e0f178cf23</guid>
            <category><![CDATA[firestore]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Syprose Gwako]]></dc:creator>
            <pubDate>Sat, 02 Jan 2021 16:04:36 GMT</pubDate>
            <atom:updated>2021-08-12T13:13:44.596Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a2Da_CQHUsSKTCTRI2tYhQ.png" /></figure><p>Have you ever wanted to move Firestore data between two projects? maybe to create a clone and run tests or to migrate from one project to another?</p><h4>The backstory</h4><p>Recently we had a situation where we needed to backtrack some operations done on data in production. We needed to make sure the backtrack will run smoothly and correctly and so the need to have a cloned copy of the production state in dev and use the data copied to run tests before moving to production.</p><p>Our set-up had two firebase projects. One used as our production instance the other for development. A <strong>Firebase project</strong> is the top-level entity for Firebase.</p><p>When you create a new Firebase project in the Firebase console, you’re actually creating a <a href="https://cloud.google.com/docs/overview/#projects"><strong>Google Cloud project</strong></a><strong> </strong>behind the scenes. You can think of a Google Cloud project as a virtual container for data, code, configuration, and services. Basically, a Firebase project <strong><em>is</em></strong> a Google Cloud project.</p><p>The example in this article demonstrates how to export Firestore data from a source project(production)and then import that data into a destination project(development) Firestore.</p><h4>So how did we do it?</h4><p>Before you can use the managed export and import service, you must complete the following tasks:</p><ol><li><a href="https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project">Enable billing for both your source project and destination project.</a> Only Google Cloud projects with billing enabled can use the export and import functionality.</li><li>Make sure your account has the necessary Cloud IAM permissions in your source project and destination project. i.e Owner, Cloud Datastore Owner, or Cloud Datastore Import Export Admin</li><li>Set up the gcloud command-line tool and connect to your project in one of the following ways:</li></ol><ul><li>Access gcloud from the Google Cloud console using <a href="https://cloud.google.com/shell/">Cloud Shell</a>.</li><li><a href="https://console.cloud.google.com/?cloudshell=true">Start Cloud Shell</a></li><li>Make sure gcloud is configured for the correct project:gcloud config set project [DESTINATION_PROJECT_ID]</li></ul><h4>1) Export Data from source project.</h4><p><strong><em>Steps</em></strong></p><ol><li><a href="https://cloud.google.com/storage/docs/creating-buckets">Create a cloud storage</a> bucket in the source project.</li><li>Use the gcloud firestore export command to export data from your source project. Replace [SOURCE_BUCKET] with the name of your Cloud Storage bucket:</li></ol><ul><li><strong>Export all data: </strong>gcloud firestore export gs://[SOURCE_BUCKET] — -async</li><li><strong>Export specific collections: </strong>gcloud firestore export gs://[SOURCE_BUCKET] — -collection-ids = [COLLECTION_ID_1],[COLLECTION_ID_2] — -async</li></ul><p>3. Take note of your export operation’s outputURIPrefix as you use this next to check on the progress of the export with the command: gcloud firestore operations describe [outputURIPrefix]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SlE8EfzoOs_VuVZIcCt0nw.jpeg" /><figcaption>Wait till operationState is successful</figcaption></figure><p><strong>Here’s the catch</strong>, If your source bucket location is different from the Cloud Firestore location of your destination project, you must move your data files to a Cloud Storage bucket in the same location as your destination project. Before importing the data to the destination firestore location, do a <strong>transfer</strong> from the source storage bucket to the destination storage bucket.</p><h4>2) Transfer data From one bucket to another</h4><p><strong><em>Steps</em></strong></p><ol><li>Create a cloud storage bucket in the destination project.(must have a unique name)to receive the data being transfered.</li><li>Open the <a href="https://console.cloud.google.com/transfer/cloud?_ga=2.178913252.1397948483.1609587895-1537064162.1607019484">Transfer page</a> in the Google Cloud Console.</li><li>Click <strong>Create transfer job</strong>.</li><li>Follow the step-by-step walkthrough, clicking <strong>Continue</strong> as you complete each step:</li></ol><ul><li>Select Source: Use <strong>Google Cloud Storage Bucket</strong> as your selected source, and click <strong>Browse</strong> to find and select the bucket you want to move your objects out of.(the source bucket in production)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*dDVHKZYEFnmv4s9fmQjFlA.jpeg" /><figcaption>Browsing for the source bucket</figcaption></figure><ul><li>Select Destination: Click <strong>Browse</strong> to find and select the bucket you want to move your objects into. <strong>In most cases browse won’t show the destination’s bucket, you can just enter its name manually</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*HUNbKishvJM2hZDrxz766w.jpeg" /><figcaption>Type in the destination bucket</figcaption></figure><ul><li>Additionally, select the checkbox <strong>Delete source objects after the transfer completes</strong>.</li><li>Configure Transfer: You can ignore this section.</li></ul><p>5. After you complete the step-by-step walkthrough, click <strong>Create</strong>. This begins the process of copying objects from your source bucket into your destination one. This process may take some time. You can view the transfer progress on the <a href="https://console.cloud.google.com/transfer/cloud?_ga=2.178437092.1397948483.1609587895-1537064162.1607019484">transfer page</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rhtQWV8iqBd5RBM4ucUJvg.jpeg" /><figcaption>Transfer progress-completed</figcaption></figure><h4>3) Import data from source project</h4><p><strong><em>Steps</em></strong></p><p>Before you can begin an import operation, you must make sure your destination project can access your Cloud Firestore data files.</p><ol><li>Create a cloud storage bucket in the destination project.(must have a unique name).</li><li>Make sure gcloud is configured for the correct project: gcloud config set project [DESTINATION_PROJECT_ID]</li><li>Use the gcloud firestore import command to import the data in your destination bucket into your destination project where [EXPORT_PREFIX]matches the pre-fix in your export operation&#39;s outputUriPrefixe.g gcloud firestore import gs://[SOURCE_BUCKET]/2019-03–05T20:58:23_56418 — -async</li><li>Check on the progress of the import with the command: gcloud firestore operations describe [outputURIPrefix]</li></ol><p>You did it! You have successfully moved data from one project to another.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7e0f178cf23" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>