Cannot create a Google Compute VM instance - google-compute-engine

I thought that this would be relatively straight forward, but I cannot start a Google Compute Engine instance at all. I am creating an instance through the web interface, but get an error after clicking the "Create" button.
The error that appears in the activity log is:
Invalid value for field 'resource.type':
'https://www.googleapis.com/compute/v1/projects//zones/asia-east1-b/diskTypes/pd-standard'.
Must be a URL to a valid Compute resource of the correct type.
Here is a screen shot of my instance settings:
Any ideas about what is going wrong? I have tried different zones and VM sizes.

Not sure why you're unable to create the instance, but you can always create it directly from the terminal with gcutil.
This command should do the trick: gcutil addinstance --zone=asia-east1-b --image=debian-7-wheezy-v20140606 --machine_type=g1-small bigquery-bi-instance

Related

Zabbix 6 Remote command not available

I am unable to get the remote command option on zabbix 6 for some reason any ideas?Operation description
if anyone can assist me i have worked through all the user manuals and they don't mention something about requirements on this drop down.
In version 6, commands are available for execution if previously defined in global scripts with Action operation selected as its scope.
In the previous versions, you just needed to select "remote command" as "operation type".
See https://www.zabbix.com/documentation/current/en/manual/config/notifications/action/operation#configuring-an-operation
Zabbix support came back with the answer on this and this is what you need to do.
Please be advised that In Zabbix 6.0 to use Scripts in Operations step you need to create such Scripts in Administration - Scripts section in Zabbix Frontend and set
Scope to Action operation:
enter image description here
Then this Script will be available in your Operations steps:enter image description here
So basically there is a seprate section to go and create your scripts and assign them to the action you want to take.

How to disable logs for whole cluster in gce

Could it be possible for already created (Yarn/Hadoop) cluster to disable logging for all servers inside ?
I can't find anything like it. Is there anything in Dataproc or Compute Engine which can help me to disable the logs ?
One easy way would be to create an exclusion in Stackdriver Logging that would prevent logs from that cluster from being ingested into Stackdriver.
You can create a resuorce based exclusion in Stacdriver - select a DataProc cluster you want and it will stop collecting any logs - hence bill you for that.
Go to Logs Ingestion page, select Exclusions and click blue button "create exclusion".
As a resource type select "Cloud Dataproc Cluster" > your_cluster_name > All cluster_uuid as shown below. Also - select "no limit" for time frame.
Fill the "Name" field on the right and again click blue button "Create Exlusion".
You can create up to 50 exclusion queries in StackDriver.
With little help and suggestion from Google support, there is complete solution to skip logging for whole yarn/hadoop cluster.
That can be possible only when create new cluster from dataproc either by google cloud page or console.
Property which should to be set in cluster properties filed:
dataproc:dataproc.logging.stackdriver.enable to be false
More info at: https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/cluster-properties
If you create cluster through console you can referral https://cloud.google.com/sdk/gcloud/reference/dataproc/clusters/create#--properties and to use command like:
gcloud.cmd --properties 'dataproc:dataproc.logging.stackdriver.enable=false'

Google Compute Engine - How to update code to all instances of an instance group?

I am following this instruction to setup multiple instances or a server cluster on GCE. It worked well, however I don't know how to update the application code. For example, I have some bug fixing and need to update the code and reload all instances. Is there anyway I could do that?
Basically you need to:
Create a new template with the bug fix (same way you did it previously).
Set it on the instance group manager: https://cloud.google.com/sdk/gcloud/reference/compute/instance-groups/managed/set-instance-template
Recreate your instances, use: https://cloud.google.com/sdk/gcloud/reference/compute/instance-groups/managed/recreate-instances
You should use Managed Instance Group Updater: https://cloud.google.com/compute/docs/instance-groups/updating-managed-instance-groups.
It allows you to recreate all instances within a group from a new template with controlled rate/speed.
Example on how to start a basic update: https://cloud.google.com/compute/docs/instance-groups/updating-managed-instance-groups#starting_a_basic_rolling_update.

Check if an exe is already running

Could someone show how it is possible to check whether another instance of the program (e.g. test.exe) is running and if so return the istance of such program beacuse I need to use a method of a class in that current status?
I would like that when I lanch the exe, first it check if it is already executing. If so, I want the status and working on the same state. Otherwise it can open a new one...

How can I prevent GCE from copying ssh keys to all new instances?

When I create a new VM instance via Cloud Console, homedirs are automatically created for users that I have created manually on previous instances, and ssh-keys are copied to ~/.ssh/authorized_keys in respective homedirs.
I don't want that! This is IMHO a serious security flaw.
I don't want any users automatically created, I don't want any ssh keys automatically copied.
How can I achieve that?
You can specify the specific users & SSH keys to use for an instance by setting the instance level sshKeys metadata key. You can also do this from the command line using gcutil's --authorized_ssh_keys option:
$ gcutil addinstance --authorized_ssh_keys=username1:/path/to/keyfile1,username2:/path/to/keyfile2,...
If you want to make sure that no instances get the full set of users/keys, you can remove the sshKeys project level metadata key. From the Console, click Compute Engine, then Metadata, then click the trash can icon next to the sshKeys key. You will then need to specify keys for each instance, or you will not be able to log in at all. (which may be what you want in a fully automated environment)
Note: Running gcutil ssh will generate a key-pair (if needed) and add it to the sshKeys key.
Google adds these ssh keys to the project ssh-keys automatically. So you need to block project-wide SSH keys: https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys#block-project-keys
You can do it via meta-data:
"block-project-ssh-keys": "true"