Skip to main content

copy datastore from one project to another project example

copy datastore from one google project to another google proejct
copy datastore from one google project to another google project


Its actually happens that we need to copy datastore values from one project to another project of google cloud platform.

Requirements :

  • Gcloud SDK on the local machine

This process goes through 4 steps.
  • Export datastore from origin project
  • Give default service user of target project the legacy storage read role over the bucket 
  • Transfer bucket data to target project's bucket 
  • Import datastore file 

Step 1  Export Datastore 

From Feb 2019, you will not be able to use datastore admin as Google is going stop that support. So you have to use cloud datastore import-export for it.

Cloud datastore import-export exports data in you specified storage bucket. To see how to setup automated datastore import-export refer this post.


Step 2 Give default service user of targe projet the legacy storage read role over the bucket 


Here we are giving read right to the bucket for origin project to targe project,
I.E. If you want to copy from project A to project B. Then give legacy storage reader role to the user of project B on the source bucket of project A
set bucket permission to make it accessble by target project's default service user
set bucket permission to make it accessible by target project's default service user

Step 3 Transfer bucket data to the target projects bucket 

Actually, in this step, it works like more copy then transfer. We have to specify from where to where we want to copy data.

So let's just start transferring data

Cloud storage transfer
Cloud storage transfer 

You will see this page if you transferring data storage for the first time

Select Source bucket
Select Source bucket
Here source bucket has to be from origin project. You can find bucket from the bucket information. please see below image. ( note bucket URL start with gs:// )
Find origin bucket url
Find origin bucket URL

Select Destination Bucket in the target project.



Select destination bucket on  target project
Select destination bucket on  target project

Create and run transfer job


Create transfer job
Create transfer job

So, up till now, we have moved datastore backup from our origin project to targe project.
Now the last step remains which is importing data from cloud storage of target project to datastore of target project.


Step 4 import to datastore


This step requires GCLOUD SDK on your local machine. I will recommend using latest SDK available at moment. As I have to update my current version.
Run this command in cmd 


Run Gcloud import command
Run Gcloud import command
 gcloud datastore import  gs://[path-to-the-over_all_export_file].overall_export_metadata


Hope you find it useful.

Stay connected!😁

Comments

Popular posts from this blog

Apache : setup basic auth with apache in windows

Authentication is any process by which you verify that someone is who they claim they are. Authorization is any process by which someone is allowed to be where they want to go or to have information that they want to have. I will show here how to set up basic auth on the apache with windows. Pre-requests  Windows VPS Apache server ( That's it ) ( In windows it might be difficult to setup the Apache alone. So instead use something ling xampp , wamp or laragon .) RestClient (  I personally use the postman , but you can use your preferable client)  Windows VPS provider Steps  Enable the necessary modules in the Apache Create the password file Set the auth directives in the virtual host file. Verify basic auth. Enable the  necessary   modules  in the Apache Open the httpd.conf file in the apache's conf folder. httpd.conf file Enable the necessary modules to make the basic auth workin...

How To Configure Sendy on Ubuntu 16.04 with nginx

How To Configure Sendy on Ubuntu 16.04 with nginx Introduction Sendy is a self hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES). You can host it on your vps. We are going to see how to host the Sendy on Ubuntu server having installed php , mysql and nginx Prerequisites Before you begin this guide you'll need the following: VPS with ubuntu 16.04 PHP MySQL nginx Step 1 — Get the licenced copy of sendy Sendy is a commercial product. You have to purchase it before using it. You can purchase it from   http://sendy.co After purchasing they will send you a copy of the sendy to your email id. Now transition to the next step by telling the reader what's next. Step 2 — Configer Sendy Extract the zip of sendy you get in the email Update the config.php file You will be able to find  config.php file inside the include folder. Update the varialbes inside config.php Set the App_PATH ...

Transpile your mithril jsx using babel's online transpiler

You can transpile your JSX based mithril component to mithril component online with help of babeljs. Goto https://babeljs.io/repl Copy your JSX component over there. Select React and ES2015 in preset for compilation. You will be getting compiled code on the right side. If you notice this compiled code is for React, and not for the mithril. You have to go one step more, Replace all the React.createElement with m and you got the code for your mithril. Cheers!