How credential and google cloud storage work? - google-app-engine

I am just starting to develop GAE web application. I am trying to get a list of bucket of google cloud storage. I found some code from web site.
there are 3 ways on the web what I found.
using Google storage API
https://code.google.com/p/google-api-java-client/source/browse/storage-serviceaccount-appengine-sample/src/main/java/com/google/api/client/sample/storage/appengine/serviceaccount/StorageSample.java?repo=samples&r=f0c6982b3cde8629511346641bfe4bb5eb28d73f
using Json liblary
but thsi sample needs to configure domain verification for bucket.
using python
our exisiting application is developped by gae for Java. I do not think thie python way can include in Java application.
then I would like to fix No1 way.
It show credential error. Buckets are authorized to everyone (All Authenticated Users )for now. I think I need to understand how the credential works. I have read the google developer page about 0Auth2. I could find a sample of bigquery. if you have a sample or good web sites about credential and google cloud storage, it will be great helpful.
the errors;
Error: com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential.(Ljava/util/Collection;)V
what i did at API console:
creating client id (web application, service account, installed application each)
creating Simple API Access ( new server key , new browser key)
what I did at local machine;
Set ACL with gsutil
my developing environment
eclipse 3.6 helios ( Japanese language pack)
gae java for eclipse
gae 1.8.0
java 1.6.31
google storage API
google client library
others(tomcat,maven)
windows 7 English with Japanese language pack

Your first attempt (number 1) is the best way to focus on getting this to work. The code sample Marc provided uses the built-in App Engine App Identity module to securely identify the App Engine app to other Google APIs: https://developers.google.com/appengine/docs/java/appidentity/#Asserting_Identity_to_Google_APIs
However, there are 2 gotchas to check:
The App Identity module will not work using the local devserver. When running locally there is no way for the local server to securely identity itself to Google production APIs - so you should either look at using a service account with a downloadable key for local testing, or, easiest option (and what I'd recommend for now), is to deploy into a production App Engine environment to test.
Make sure the App Engine service account email address is added to the access control list for the Google Cloud Storage bucket that you are trying to access. Get this email address by looking under the Admin Console (for your App Engine app) -> Application Settings:
Service Account Name:
xxxxxxx#appspot.gserviceaccount.com
To add this to a Google Cloud Storage access control list, either add it to the project team for the project that owns the Google Cloud Storage bucket, or, if you're not using the default access control settings, add it directly to an ACL:
https://developers.google.com/storage/docs/accesscontrol
Service accounts with downloadable key - use this for local testing if you can't test in a production App Engine environment:
https://developers.google.com/accounts/docs/OAuth2ServiceAccount

Related

There is limit on google cloud projects and firebase projects?

I build websites, maybe 100 per year maybe more and I start to use Firebase and Google cloud for my hosting and as a backend but after some projects on blade for firebase I am not able to create new projects.
I make project quota to increase my projects but I don't have any response
My point is there is any alternative for hosting angular 2 apps with node.js
backend
There are lot more of hosting options available on google cloud than only firebase.
Google App Engine(Standard) is one of them. They even give you a predefined run time environment. If you want to use node.js in the background you just have to mention node as your runtime environment in the application configuration file.
Then there is Google App Engine(flexible)
If you want to create your own virtual machine and create your own servers you can choose Google Compute Engine

Securely providing external service credentials to Google App Engine?

I'm just getting started with Google App Engine, and I'm having trouble figuring out how to securely provide credentials for external services to a deployed app. I saw that you can put environment variables in the app.yaml config file, but I don't want to store secret credentials in plain text on my local machine, and I would like to store the deploy agnostic parts of the app.yaml in version control.
What are the best practices for providing Google App Engine with sensitive deploy specific variables?

Adding domain to Google Cloud Storage hosted web-app

I am new to Google Cloud Storage.
I want to try Google Cloud Storage to host my web-app. Is it possible to upload my website to Google Cloud Storage and connect own domain without Google Apps premium subscription?
If yes, please check my steps below, how I tried to make it works, and let me know where I where wrong?
I have created Cloud Console project for my web-app. My Project ID: rippl-io
Then linked the domain of the web-app to existing Google Apps account as a secondary (as I were redirected to Google Apps after trying to add new domain from the cloud console). Domain name I am going to use: rippl.io
In App Engine settings in Google Apps I am clicking "Add new url" and selecting rippl.io domain. But it returns error.
I am guessing I can add only primary domain and that must be a reason of error. So, next, to change rippl.io to primary domain I need to upgrade Google Apps to premium. Are any other ways to add own domain to my website on Google Cloud Storage other than buying premium Google Apps?
To add domain # Google Cloud Storage, first you need to verify it from Google Webmaster Tools, then create a bucket exactly matching your domain name e.g. www.example.com upload your data, files etc, then add CNAMEentry www.example.com IN CNAME c.storage.googleapis.com.
Please remember, Google Cloud Storage will work for plain html webpages it will not execute any server side codes like php
gsutil web set -m index.html -e missing.html gs://www.example.com
If you still have php page, you can use below code, but php code will get displayed in webpage view source, it will not get execute:
gsutil setmeta -h Content-Type:text/html gs://www.example.com/demo.php
To add domain # Google App Engine, you need Google Apps for Business account to verify it.

Using Google App Engine services outside of uploaded application

I am looking to use Google Cloud Storage services outside of launching a google app engine application. My application is designed for running on a hosted server of our own, and I would like to still use the cloud storage service.
I've written a dev app that did this, and ran it with dev_appserver.py in the python GAE framework. It seems the dev_appserver.py is necessary as it fills in how to perform the RPC functions the cloud storage provides.
Is there a way to easily use google cloud storage service without the rest of it?
There is gsutil command line tool:
https://developers.google.com/storage/docs/gsutil
There is an xml/json restful service all at:
https://developers.google.com/storage/index
You'll need to enable the google cloud storage on the google console at:
https://code.google.com/apis/console/ and get the necessary api keys.

Project created from App Engine Console comes with less features compared with project created from Cloud Console

When I create a new Application from App Engine Console https://appengine.google.com/,
the application also appears on Cloud Console https://cloud.google.com/console#c=l
However, clicking into the project shows that only these features are included:
App Engine
BigQuery
Cloud Datastore
Compared with Project created directly from Cloud Console:
App Engine
Compute Engine
Cloud Storage
BigQuery
APIs
Cloud Datastore
Cloud SQL
That leads to problem that App Engine project is missing access to many features and there seems no obvious way to add them back later.
Any idea what's wrong here?
1,This only implies that when you create an application from app engine console, it directly creates 3 types of projects: app engine app, datastore instance and big query(i think you need to enable the api first) with the same project id. This does not mean you cannot use the other features. It only means you need to separately enable them and give project ids.
2, If you create a project from cloud console, then it will automatically create projects under all the 7 different categories with the same project ID
Finally I found how to do this:
Go to https://appengine.google.com/
Open your app
Open Administration / Application Settings
Click the button in the "Cloud Integration" section

Resources