In my previous post, I talked about how to deploy ASP.NET apps to Google Cloud. In this post, I want to point out a short Cloud Minute video that quickly shows how to deploy ASP.NET apps to Google Cloud. Enjoy!
In my previous post, I talked about how to deploy ASP.NET apps to Google Cloud. In this post, I want to point out a short Cloud Minute video that quickly shows how to deploy ASP.NET apps to Google Cloud. Enjoy!
I consider myself a Java developer first but during my time at Microsoft and Skype, I had the chance to learn about C# and .NET. Over time, I started liking the advanced features in C# (that Java just recently started having) and the great ecosystem and tooling around .NET.
When I moved to Google and started working on Google Cloud Platform, I was naturally very happy to learn that Google Cloud Platform supports .NET applications.
In this blog post, I want to provide an overview of .NET support on Google Cloud Platform and talk about .NET client library.
If you want more details, .NET on Google Cloud Platform is the best page to get started, it includes quickstarts, code samples, tutorials and more.
First question you probably have is: What kind of .NET applications can I host on Google Cloud and how? You can host ASP.NET applications on Windows Server running on Compute Engine.
The easiest way to get started is to use Cloud Launcher ASP.NET Framework to deploy Windows Server 2012, Microsoft IIS, ASP.NET, and SQL Express on a Compute Engine instance.
Once the ASP.NET stack is installed, ASP.NET apps can be deployed from Visual Studio using the regular Web Deployer (no special plugin needed) to your Compute Engine instance.
.NET on Google Cloud Platform page includes a Hello World with .NET sample on details on how to deploy .NET apps on Google Cloud. There is also a How to get your ASP.NET app up on Google Cloud the easy way post on Google Cloud Platform blog that you might find useful.
Once you have your basic ASP.NET app running, you probably want to know what .NET APIs and libraries exist for which part of Google Cloud Platform.
Currently, there are 2 different .NET libraries for Google Cloud Platform: Google API Client Library for .NET and Google Cloud Platform Client Libraries for .NET. The latter libraries are currently in Alpha and Beta stages, so I won’t talk about them in detail here but stay tuned for more details in a future post.
Google API Client Library for .NET is currently the official library for many Google services, including Google Cloud Platform. It includes .NET APIs for many Google Cloud services such as Cloud Storage, BigQuery, Pub/Sub, Dataflow and more. The full list is on their APIs page (search for “cloud” for Google Cloud related APIs).
I want to outline some of the main .NET APIs for storing data, messaging, BigQuery and point to their NuGet packages and source code for easy reference.
Every application needs some kind of structured data and you have 2 options to store structured application data:
You can use Google Cloud Storage to store binary data with Cloud Storage JSON API Client Library for .NET (NuGet | Source).
You can use Google Cloud Pub/Sub for publish/subscribe messaging with Google Cloud Pub/Sub API Client Library for .NET (NuGet | Source).
You can work with Google Cloud BigQuery with BigQuery API Client Library for .NET (NuGet | Source).
For the rest of Google Cloud Platform, you can find APIs on Google Compute Engine, Google DataFlow, Google Cloud Dataproc and many more under APIs section of Google API Client Library for .NET.
There is also a GitHub repository called dotnet-doc-samples where more and more samples are being added for .NET on Google Cloud Platform.
As you can see, .NET is a fully supported framework and it’s only going to get better, so I’m very excited to see how .NET support will evolve going forward on Google Cloud Platform.
The usual way of managing Compute Engine instances is from GCP Console. However, if you need programmatic access to Compute Engine, there is a comprehensive REST API. There are also client libraries (that basically wrap the REST API) provided by Google and the community, for Java, .NET, Go, JavaScript, Ruby and more.
In this post, I want to take a look at the Java client libraries. There are 2 client libraries for Java:
A good starting point to explore Google API Client Library for Java is Compute Engine Cmdline Sample. This sample basically contains a single class ComputeEngineSample that lists all compute engine instances you have in your project from Java. Nothing earth-shattering but it shows how to authenticate with Google API and interact with Compute Engine.
There’s an instructions.html file that tells you how to setup and use the sample. One thing you’ll realize is that you need to grant API access to your Java app before you can run the sample but instructions.html is a little outdated on that. This is what you need to do to grant API access:
Once that’s done, you can import the project into Eclipse (or your favorite IDE), fill client_secrets.json in resources folder with client ID and secret from step 5, and fill the following info in ComputeEngineSample:
APPLICATION_NAME: Optional but give it a name, so you don’t get warnings.
projectId: Your project id from Developers Console.
zoneName: Make sure to enter the right zone for your project. In my case, I chose europe-west1-c.
That’s it. Now, you can run ComputeEngineSample from Eclipse (or your favorite IDE) and you can get info about your Compute Engine instances right from Java:
================== Listing Compute Engine Instances ================== { "canIpForward" : false, "creationTimestamp" : "2016-02-16T05:58:00.714-08:00", "description" : "", "disks" : [ { "autoDelete" : true, "boot" : true, "deviceName" : "instance-1", "index" : 0, "kind" : "compute#attachedDisk", "mode" : "READ_WRITE", ....
As I’m learning about different parts of Google Cloud Platform (GCP), I thought it’d be a good idea to share my notes. GCP documentation is great and it contains a lot of detailed information but sometimes I prefer cheat sheet style notes and that’s what I intend to provide here.
GCP is nicely divided into different sections: Compute, Storage, Networking, Big Data, Services, Management. I started looking into Compute layer and more specifically, Compute Engine. Here are my notes on Compute Engine.
These are different management options for Compute Engine: