I want to create an image which is reachable in every project for everbody.
How can I make it?
Currently I have a snapshot. I made a persistent disk with this image so my idea is to create a google storage blob and copy it across the projects and create an image in every project.
Can I somehow copy a disk into the storage account.
Or anybody has better idea?
My suggestion is to export an image to Google Cloud Storage following these steps that you can find in the documentation.
After that you should be able to run the following command:
gcloud compute images create IMAGE_NAME --project PROJECT --source-uri gs://BUCKET_NAME/IMAGE_NAME.image.tar.gz
as per Adrian's answer:
Sadly Google don't make your life easy here... frankly the lack of easy Image migration project-to-project is a bit of a thumbs down at the moment for GCE.
Related
I've written a script in Google Colab that performs some queries via API to a server where I host some information, let's say weather data from several weather stations we own, that data is downloaded in a JSON format then I save those files in my Google Drive as I'll use them later in the same script to generate some condensed tables by country and by month, those summary files are also stored in my Google Drive account. After that, I send the summary files via email to some people.
I need to run this script every other day and, well, it is no big deal to do that, but I'd like to make it happen without human intervention, mainly because of scalability. One of the main points is that some libraries are not easy to install locally and it is way easier to make it work in Colab, that's why I don't use some solutions like crontab or windows scheduler to perform this, and I need to make the Colab notebook to run periodically.
I've tried solutions like PythonAnywhere, but I've spent too much time trying to modify the script to work with PyDrive and, so far, haven't achieved it. I've also tried to run it using GCP but haven't found how to access my Google Drive files yet using Google Cloud Functions. I've been also working on building an image using Docker and if I deploy it to someone else, it'll be working, but the idea is to make the running schedulable not only deployable. I've also read the Colabctl option but haven't been able to make it run yet.
Please, I'm open to receiving any suggestions in order to achieve my goal.
Thank you,
Billy.
there is a paid scheduler https://cloud.google.com/scheduler
or you can use https://github.com/TensorTom/colabctl with your own cron
I have a database file which is located on my own google drive (private) and it's updated on a daily basis.
I wrote a python script in order to track the data from the database file, however I need to download the DB file to my pc, and then running my script locally, every single day.
I am wondering if there are any better options, so I wouldn't have to download the DB file and move it manually.
From a slight searching on the web I found that there is no way to run the script in the google drive folder (obviously due to security issues), and using google cloud platform is not a real option since it's not a free service (and as I understood there is no free trial).
Anyways, any method that would make my life easier would be happily accepted.
Sorry
That's not possible AFAIK. At least in the way you have asked the question.
It may be that you are looking for a Database hosting service, which, as a rule, are not free. I remember seeing a SQL viewer around, I don't know if it is still available and I don't think it was accessible via a local Python script.
Google Cloud Platform, as other services, do however offer a free tier of services - though this depends on how much use you need to give it and also on your location. Though this can get quite involved quite quickly. There are also various options to choose from. For example Big Query may be something you are interested in.
A Possible Workaround
I assume that the reason you don't want to download it is because it is tedious, and not because your network connection or hard drive can't handle it, if so:
The simple workaround may just be to find a way to automatically download the database via the (Google Drive API)[https://developers.google.com/drive] with your Python Script, modify it, or read it, and then upload it again if you need to. This can be done all within one script using the API. So all you would need to do is run the Python script and you wouldn't need to manually download and move it into a folder. You would also not need to worry about running over the free tier and getting billed for it.
You could even use the Google Drive Desktop software to keep the database file synced locally. Since it is local, I doubt the software would be able to block a Python script on the file system.
If you don't even want to think about it, you could set up the Python script with a CRON job or a Scheduled task if you are on Windows.
On GCP Compute Engine, I have a Project A with several VMs running. I am not using App Engine.
How can I duplicate or make an exact copy of Project A into a second Project B (having the same VMs config and all its source and data files in Project A) thus resulting in two exact Projects?
I can't seem to find a solution. Thank you.
Unfortunately there is no "copy project" internal tool to perform such a task. Speaking about VMs,the fastest way to move existing VM would be by making disk images and creating new instances at the new project using the image from your old project using the "-image-project IMAGE_PROJECT" flag.
Just curious if there's a standard method to take one VM instance and migrate it to a completely different Google Cloud account. If not, I guess I could download all the site files and server configuration files (virtual hosts, apache config, php.ini, etc) but am hoping there's a more streamlined approach.
Just to be clear I have john#gmail.com and john2#gmail.com, both completely separate accounts each with VMs on their respective Google Cloud accounts. I want to move a VM instance from john#gmail.com to john2#gmail.com
I'm open to any method that will get the job done. I like Google's snapshot feature but I have doubts I'll be able to move the specific snapshot over. I'm thinking maybe it'll be possible by creating an image but even that I'm not 100% sure.
Thanks!!
Create a custom image, then share it, then import that image into the target project.
My site is a bit more of a static site. The site is based on word-press now, and I am thinking of using auto scale feature.
The problem is that I am not good at startup scripts like python, java, etc...
I am more comfortable with bash script.
Is there a way create a snapshot of a production compute-engine and use it as a template instead of instance group without startup script complexity?
I have two instances, one is an individual instance and one is an inside instance group for auto scale. Whenever there is a update in my site, I have to change it in individual instance and move the snapshot disk as template in instance group and everything will be updated.
My question is, is that workable or do I really have to work on startup script?
Any friendly advice will be highly appreciated.
Some bash skills should be enough to write a startup script and not use the additional instance and image creation at all. See documentation for an easy example of that - just put in all bash commands that you use to prepare that instance yourself. This should be relatively easy and allows for easy modification of that process later on.
If you really want to avoid writing the script, what you’ve described should be possible: take an instance that has everything installed as you like it, then delete it keeping the disk and create an image out of that disk.
One minor improvement: you can use an instance from the existing instance group by abandoning it.