I wanted to do what I used to do with my Linux machine on a GCP (google cloud platform) server, so I created a Linux machine as a VM on GCP and even ran the program. I've done it to the minimum, so it's a memo.
Basically a blog post -GCP (GCE) starting from now on, safely use the free tier -Start a Linux server using GCP Compute Engine
By following the above, I think that it is okay for those who are accustomed to it. I read this and followed it, but I couldn't log in to the VM I created because I was creating a new project but I wasn't setting it in the new project where I was using local gcloud. Also, I don't know the price well. It is a memo in the state.
View the current project.
> gcloud config list
[core]
account = [email protected]
disable_usage_reporting = True
project = myproject-000000
Your active configuration is: [default]
Switch to the created project.
> gcloud auth login
> gcloud config set project myproject-000000
Check if there is an instance created. At first, I noticed that the project settings were incorrect because the VM I should have created here was not an instance.
> gcloud compute instances list
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
myinstance us-west1-b n1-standard-1 10.11.0.2 12.123.123.123 RUNNING
If you have an instance, log in with gcloud ssh. Is it okay if I haven't created any VM accounts? I thought, but when I typed this command, Putty started up, asked for the pass phrase setting, pressed the return key (no setting), and entered the terminal where I logged in.
> gcloud compute ssh myinstance --zone=us-west1-b
After logging in, it felt like it could be used normally, so there are no problems so far. Many thanks.
The order is reversed, but it is a memo until the virtual machine is created. This was done at console.cloud.google.com. Suppose you are in a project.
(1) Select a VM instance from Compute Engine.
(2) Select "Create" for the VM instance.
The rest is written in various articles, but you can select the region, OS, etc. I didn't know which one was better, so I chose the one that was written in the blog. After all, I don't know for now if it's free. (The cost was listed as $ 24 per month, but it may be free with a deposit for one year, but I'm not sure, so ignore this part of my article.) Ubuntu 19, 30G , I chose US Oregon. The result is an instance.
And, as I wrote earlier, I logged in with gcloud.
This is to keep the previously written Indoor Humidity Log. We have now moved the machine running the python script that we receive as an MQTT client and save to a file into a virtual machine. I know there is a smarter solution, but I would like to improve it little by little.
From now on, I would like to put the public key over there so that I can ssh normally from here. In the first place, I want to save it directly to Container using Google's pub / sub. .. ..
Recommended Posts