Top 5 Power Features of the Google Cloud CLI

If you’re a heavy user of Google Cloud Platform, you probably already know about Google Cloud SDK, the powerful command line tool for working with all things Cloud Platform, available for Windows, Linux and OS X. In this post, the Cloud SDK engineering team, based in New York City, shares their favorite power features of the Google Cloud command-line interface (CLI).

#1. Using cloud service emulators

Whether you’re on your commute without connectivity, want a fast reliable way of running tests, or just want to test your application on your development machine without talking to a remote service, gcloud emulators is your friend. Emulators provide a local mock implementation of Google Cloud services, so you can develop and test core functionality. Currently the Cloud SDK includes Google Cloud Datastore and Google Cloud Pub/Sub emulators, with more to come.

You can start an emulator, such as the emulator for Cloud Datastore, like so:

$ gcloud beta emulators datastore start
...
[datastore] To connect, set host to http://localhost:8967/datastore
[datastore] Admin console is running at http://localhost:8851/_ah/admin

Now, you’ve got a datastore running on your local machine! The API is available at the port on localhost, listed above.

Client libraries such as gcloud-node, gcloud-ruby, gcloud-python, and gcloud-java can be configured to use this local emulator by respecting the DATASTORE_LOCAL_HOST
environment variable.

The gcloud emulators command has a neat little trick for automatically setting environment variables like this for each service.

$ $(gcloud beta emulators datastore env-init)
$ echo $DATASTORE_HOST 
http://localhost:8967

The emulator comes with a simple, web-based console which is also available on localhost. Read more in the gcloud emulators documentation.

(Pro tip from Vilas, Engineer on the Cloud SDK)

#2. Type like the wind with autocompletion


Another power feature of the Cloud CLI is tab auto-completion. You can tab-autocomplete gcloud subcommands, and also for many entities such as your instances and zones. Try it out!
(Pro tip from Mark, Engineer on the Cloud SDK)

#3. Using --format to filter, sort and transform output to CSV, JSON, and more


The Cloud CLI gives you a lot of information about your environment, which you might often want to use as input to another script or program. The --format flag provides an easy way to massage the output into a format that makes sense.

Here’s an example using the --format flag to list the zone and IP of your Google Compute Engine instances in CSV format, sorted by zone and name.

$ gcloud compute instances list \
   --format='csv(zone:sort=1,name:sort=2,networkInterfaces[0].networkIP)' 
   > list.csv

You can then open the CSV file in a viewer such as Google Sheets:
This is just a taste of what --format supports. You can also expose data in JSON and tabular format, and use projections to select, sort and filter your data. Read more in the Google Cloud SDK reference for the --format flag to learn some more neat tricks you can do with --format.

(Pro tip from Glenn, Engineer on the Cloud SDK)

#4. Using the gcloud tool with PowerShell


If you’re a user of PowerShell, then often it’s handy to work with PowerShell objects. Some tweaks to the --format command allow you to do this. For example, if you use this command to list all Compute Engine instances in Asia:

PS> (gcloud compute instances list --format=json | Out-String | 
ConvertFrom-Json) | ?{$_.zone -match 'asia'} | select name

name
----
asia-ops-1
asia-ops-2

You can use this command to restart all the instances in Asia:

PS> (gcloud compute instances list --format=json | Out-String |
ConvertFrom-Json) | ?{$_.zone -match ’asia’} | %{gcloud compute instances
reset $_.name --zone $_.zone}

(Pro tip from Valentin, Engineer on the Cloud SDK)

#5. Easily ssh to your Compute Engine instances


The gcloud CLI offers a number of ways to easily use secure shell to access any Linux-based Compute Engine instances you have. For example, you can run:

$ gcloud compute ssh my-instance-name

This command automatically connects you through SSH to any instance that can be accessed publicly. No more SSH keygen or looking up external IPs!

You can go a step further with:

$ gcloud compute config-ssh

This command creates an alias for each of your Compute Engine instances to your ~/.ssh/config file. These aliases are then available to system utilities that also use SSH, such as ssh, scp and sftp. Now you can type commands from your terminal such as:

$ ssh myvm.asia-east1-c.myproject

or

$ sftp myvm.asia-east1-c.myproject

Read more about the gcloud compute ssh command or the gcloud compute config-ssh command
in the documentation.

(Pro tip from Stephen, Engineer on the Cloud SDK)

- Posted by the Google Cloud SDK team

Thank you for reaching out to us. We are happy to receive your opinion and request. If you need advert or sponsored post, We’re excited you’re considering advertising or sponsoring a post on our blog. Your support is what keeps us going. With the current trend, it’s very obvious content marketing is the way to go. Banner advertising and trying to get customers through Google Adwords may get you customers but it has been proven beyond doubt that Content Marketing has more lasting benefits.
We offer majorly two types of advertising:
1. Sponsored Posts: If you are really interested in publishing a sponsored post or a press release, video content, advertorial or any other kind of sponsored post, then you are at the right place.
WHAT KIND OF SPONSORED POSTS DO WE ACCEPT?
Generally, a sponsored post can be any of the following:
Press release
Advertorial
Video content
Article
Interview
This kind of post is usually written to promote you or your business. However, we do prefer posts that naturally flow with the site’s general content. This means we can also promote artists, songs, cosmetic products and things that you love of all products or services.
DURATION & BONUSES
Every sponsored article will remain live on the site as long as this website exists. The duration is indefinite! Again, we will share your post on our social media channels and our email subscribers too will get to read your article. You’re exposing your article to our: Twitter followers, Facebook fans and other social networks.

We will also try as much as possible to optimize your post for search engines as well.

Submission of Materials : Sponsored post should be well written in English language and all materials must be delivered via electronic medium. All sponsored posts must be delivered via electronic version, either on disk or e-mail on Microsoft Word unless otherwise noted.
PRICING
The price largely depends on if you’re writing the content or we’re to do that. But if your are writing the content, it is $60 per article.

2. Banner Advertising: We also offer banner advertising in various sizes and of course, our prices are flexible. you may choose to for the weekly rate or simply buy your desired number of impressions.

Technical Details And Pricing
Banner Size 300 X 250 pixels : Appears on the home page and below all pages on the site.
Banner Size 728 X 90 pixels: Appears on the top right Corner of the homepage and all pages on the site.
Large rectangle Banner Size (336x280) : Appears on the home page and below all pages on the site.
Small square (200x200) : Appears on the right side of the home page and all pages on the site.
Half page (300x600) : Appears on the right side of the home page and all pages on the site.
Portrait (300x1050) : Appears on the right side of the home page and all pages on the site.
Billboard (970x250) : Appears on the home page.

Submission of Materials : Banner ads can be in jpeg, jpg and gif format. All materials must be deliverd via electronic medium. All ads must be delivered via electronic version, either on disk or e-mail in the ordered pixel dimensions unless otherwise noted.
For advertising offers, send an email with your name,company, website, country and advert or sponsored post you want to appear on our website to omodjk(at)gmail(dot)com

Normally, we should respond within 48 hours.

Previous Post Next Post

Ad — After Posts / Before Footer

                     Copyright Notice

All rights reserved. This material, and other digital contents on this website, may not be reproduced, published, rewritten or redistributed in whole or in part without prior express written permission from Alexa News Network Limited (Alexa.ng). 

نموذج الاتصال