skip to Main Content

I had an instace VM called "wp-nginx-ssl-bitnami-vm-vm" but it disappeared. It no longer appears on the instances page. paid the platform normally without interruptions.
I didn’t find any log record about instance deletion. she just disappeared. how do i recover?

2

Answers


  1. Note: The following information is valid only if the instance deletion happened less than 30 days ago unless you previously set up custom log retention to keep logs for a longer period of time.

    Google Cloud Compute instances do not suddenly disappear. Google Cloud records activity such as creating an instance (compute.instances.insert) and deleting an instance (compute.instances.delete) in the activity logs.

    Use the following steps to investigate the issue of the missing instance. Once you know what has or has not happened, you might have a better change of figuring out a strategy.

    To find the logging event for when the instance was deleted, execute the following command which will output the log details in JSON.

    gcloud logging read 'protoPayload.methodName:"compute.instances.delete"' 
    --project=GCP_PROJECT_ID 
    --format=json
    

    If the output is empty, then the instance was either deleted outside the logs retention period, has not been deleted or did not exist in the specified Project ID.

    Note: replace compute.instances.delete with compute.instances.insert to find the creation time if that event is still in the logs.

    The log entry will contain information on when the event happened:

    "receiveTimestamp": "2021-06-10T01:33:46.314371022Z",
    

    Who deleted the instance:

    "protoPayload": {
      "@type": "type.googleapis.com/google.cloud.audit.AuditLog",
      "authenticationInfo": {
        "principalEmail": "[email protected]"
      },
    

    And details on the caller’s IP and User Agent:

      "requestMetadata": {
        "callerIp": "78.123.234.111",
        "callerSuppliedUserAgent": "Mozilla/5.0 ..."
      },
    
    Login or Signup to reply.
  2. Please see the answer by @john-hanley

    Additionally, if perhaps the instance is in another project, you can list all the projects that have Compute Engine service enabled and all their instances using:

    # Compute Engine service name
    COMPUTE="compute.googleapis.com"
    
    # List of projects accessible to the current account
    PROJECTS=$(
      gcloud projects list 
      --format="value(projectId)")
    
    # Iterate over them
    for PROJECT in ${PROJECTS}
    do
      # Look for projects where Compute Engine is enabled
      ENABLED=$(
          gcloud services list 
          --enabled 
          --filter="config.name=${COMPUTE}" 
          --format="value(config.name)" 
          --project=${PROJECT})
      # If it is
      if [ "${ENABLED}" = "compute.googleapis.com" ]; then
        # Output the Project(ID) and the list of instances
        echo "${PROJECT}:"
        gcloud compute instances list 
        --format="list(name)" 
        --project=${PROJECT}
      fi  
    done
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search