Google Cloud Shell unable to display files present in Google Storage - google-app-engine

Image1 available clearly shows that the bucket contains a folder namely cloudml-samples-master and a file namely setup.py
However on entering the command ls in Google Cloud Shell, it is giving no output. I am stuck at this problem and I have tried almost everything but I am unable to find the reason behind this.
Also when I am trying to access these files through my API, I get an error displaying that these files could not be found.
Both the files present in the directory were uploaded using WebUI.
To add my opinion, what I understood till now is that the files being uploaded using WebUI and those uploaded using command line are acting independently. Because I have seen that the files which I am uploading using command line are not showing in UI. Is there some error from my side or is it an issue related with Cloud Google Storage?

As you can see below from https://cloud.google.com/shell/docs/features, Google Cloud Shell is not connected directly with Google Cloud Storage. It gives you possibility to connect with that storage eg. via gsutil
When you start Cloud Shell, it provisions a g1-small Google Compute
Engine virtual machine running a Debian-based Linux operating system.
Cloud Shell instances are provisioned on a per-user, per-session
basis.
Also:
Cloud Shell provides the following:
A temporary Compute Engine virtual machine instance Command-line
access to the instance from a web browser Built-in code editor BETA
5 GB of persistent disk storage Pre-installed Google Cloud SDK and other tools Language support for Java, Go, Python, Node.js, PHP, Ruby
and .NET Web preview functionality Built-in authorization for access
to GCP Console projects and resources

Related

GCP App Engine deploy and using a Google Cloud Storage Client Library

I installed the Cloud Storage Client Library in my local machine with composer.
My App Engine app uses StorageClient, like the sample code below, to write a file to a Cloud Storage Bucket.
require 'vendor/autoload.php';
use Google\Cloud\Storage\StorageClient;
$storage = new StorageClient();
$bucket = $storage->bucket('my_bucket');
// Upload a file to the bucket.
$bucket->upload(
fopen('/data/file.txt', 'r')
);
Are the libraries being copied to the respective App Engine instance when I deploy this app?
Was the authentication process/service account for copying the libraries down to my machine?
Is there a separate charge for using the libraries?
Are the libraries being copied to the respective App Engine instance when I deploy this app?
In a way they’re copied to the respective App Engine instance but not from your local machine.
This happens during the build stage of the deploy process and you can confirm it by viewing the build results. You can do that using the Google Cloud console or the Google Cloud SDK.
Here’s an example to view the build logs from the last deployment.
gcloud builds log $(gcloud builds list --format json | jq -r ".[0].id")
You can use it in Google Cloud Shell and also pipe it to grep like this:
gcloud builds log $(gcloud builds list --format json | jq -r ".[0].id") | grep composer
Is there a separate charge for using the libraries?
As explained in the documentation for App Engine Pricing, depending if you’re using the Environment Standard or Flexible, the billing rates differ.
With Standard Environment you choose an instance class and you’re billed per hour per instance accordingly while with Flexible Environment you’re billed for resources.
So in the former case you’d have to determine the amount of RAM memory you believe fits your needs while on the latter you can see more clearly the effect on your project’s billing of the amount of dependency libraries you have installed for your app.

Google App Engine CLI - list project directory

Is there a way to print the contents of my project directory using the google app engine cloud shell?
In my local terminal that would look like typing 'ls'
What command would I use in the shell?
The cloud shell is fundamentally just a shell running on a generic virtual machine in the cloud.
That machine does NOT have any special attributes (compared to your local machine) except maybe that it comes with some tools (like the google cloud SDK) already installed. It has no implicit knowledge about or access to your cloud products/projects themselves.
So, by default, the cloud shell doesn't know which/where your GAE project is. You'd have to pull a copy of your project repository/code on that instance and, when in that project's directory, you could list the project's content using ls, just like on your local machine. See also the somehow related Google Cloud: How to deploy mirrored Repository
The machine on which the cloud shell runs is also unrelated to the instances on which GAE apps are running, so you can't directly list on it the directory content of the actually deployed GAE project. If that's what you're after see Where are appengine projects located normally in the file system of the server via ssh?

Why does writing to GCS bucket result in local dev blob store entries instead?

I use the Google App Engine Standard environment to develop my Python app using Development SDK 1.9.61.
I'm trying to learn to use Google Cloud Storage in my app by following these instructions. I verified that my default and staging buckets do exist via the cloud console, and manually uploaded a sample file to each bucket using my browser.
Next, I programmatically uploaded some files to a bucket (so I thought) via my local development app instance per Google's instructions.
However, when I checked my cloud storage buckets via my GCP Console in my browser, I could not find the files. After searching my local development SDK console, I eventually found the files located in the local "Blobstore Viewer".
I'm confused, based on Google's instructions I expected to find the files in my project's cloud storage bucket.
I searched the App Engine Python Release Notes for some potential SDK version changes to explain this behavior, but couldn't find anything relevant.
Is this the way it's supposed to work? Are Google's instructions in error?
If you upload files to a local development server, those exist in-memory on your machine. The GCP Console doesn't interact with your local development server, it interacts with the public (production) Google Cloud Storage API.
So in essence, the files on your local dev server are in a completely different namespace. If you want to interact with the production version of Google Cloud Storage and see the results in the GCP console, you'll need to use a non-dev-server deployment of your application.

Error message "service cloudbuilt.googleapis.com is not for consumer..." when deploying App Engine application

My team and I are working on the Trendy Lights Tutorial.
We have set up all the files and also have converted the .p12 key to .pem key but failed to run the app on the Google Cloud Platform and constantly got the error message saying:
You do not have permission to access project [...] and service
"cloudbuilt.googleapis.com" is not for consumer..."
We have already whitelisted our service account for the use of Earth Engine. Does anyone know what the problem might be?
Thank you so much!
I see that you are attempting to deploy your application to the App Engine Flexible Environment.
The Flexible environment differs from the Standard environment in that it gives you more control over the individual instances that are running your deployed application. It does this by hosting your application within Docker on Compute Engine virtual machines.
Therefore, you will need to enable the Compute Engine API for your project so that the GCloud tool can start new Compute Engine virtual machines when you deploy your application.
Note: Since the Flexible environment uses Compute Engine resources, you will also need to enable billing for your project.
If after performing the above you still experience the 'cloudbuild.googleapis.com' error, I ask that you run gcloud components update, then ensure that the value of account seen in the output of the command gcloud info has Owner or Editor permissions in your project.
If it still persists after all of the above, you should then open a Public Issue Tracker to inform our backend team of the issue.

Where are Node apps deployed using gcloud SDK?

I've deployed a Node app to Google Cloud. It works beautifully.
However, where is the app running? Where in the directory structure of my instance is it stored?
I'd also like to identify where stdout is on that process. The logging solution in the GAE console is powerful but excessive for some of the simple debugging tasks I have.
Your application runs inside a Docker container and hosted on one or more instances that AppEngine provisioned for you when you deployed your application. AppEngine is managed runtime environment and thus you are not supposed to access the instance/container directly. The internal directory structure is exactly the same as you've built it during the development process.
The stdout is redirected to Google Cloud Logging. You can filter the log by severity (debug, errors, everything etc..) to reduce the amount of data you need to read.

Resources