How do you add a label?
In the Developers Console, you can add, view and modify labels by selecting the resources you want to label, either a project or virtual machine instance and then clicking “Edit labels.”After you have created a label, you can also add it as a column in your VM list view.
How do you filter with labels?
After adding labels to your resources, you can filter these resources using your labels. Just type a key or value into the Search box in the Developers Console and the filter box will auto suggest the right queries and allow you to preview results.Common Uses
Here are some typical ways for you to use labels:- Label based on team or Cost Center – To distinguish projects owned by different teams. This can be used in cost accounting or budgeting. For example team:marketing, team:research
- Label based on component – For example, component:redis, component:frontend
- Label based on environment or stage – For example, environment:prod, environment:test
- Label based on owner or contact – If there’s an individual who’s responsible for a resource and is the primary contact for the resource
- Label based on state – For example, state:inuse, state:readyfordeletion
Elements of a label
- A label is a key:value pair that can be attached to a project or a VM
- Label keys and non-empty label values can contain lowercase letters, digits and hyphens, must start with a letter, and must end with a letter or digit. The regular expression is [a-z0-9][a-z0-9._\-]*
- The length of labels keys and values is up to 63 characters
- There can be a maximum of 64 labels per resource
- VM tags you defined in the past will also show up as value-less labels
What about APIs?
You can access labels in APIs as well as the Developers Console. Below is an example that creates and filters VMs by labels. You might also want to read the API documentation for project labels and VM labels.Setting VM labels
You can update the labels on an instance with a POST request to the setLabels path. You’ll need the project ID, zone and instance name for the request, and you’ll need an OAUTH token for authentication. The JSON request body should contain the new set of labels plus the labels fingerprint. The fingerprint is a hash of the existing labels, which is returned when you do a GET on the resource. This performs optimistic locking and prevents multiple requests from being made on the same resource.Note that setLabels replaces ALL the labels for an instance, following the read-modify-write pattern. If you want to update a subset of the labels, you’ll want to read out the labels, make the changes needed and then call setLabels with the full list of labels.
$ curl --request POST --header "Authorization: Bearer your-oauth-token" --header 'Content-Type: application/json' --data '{"labels": {"env": "canary"}, "labelFingerprint": "abcdefghij="}' https://www.googleapis.com/compute/alpha/projects/your-project-id/zones/your-zone/instances/your-instance/setLabels
{
"kind": "compute#operation",
"id": "1234567890",
…
"selfLink": "https://www.googleapis.com/compute/alpha/projects/your-project-id/zones/your-zone/operations/operation-12345678"
}
Filtering by label in list requests
After you've set the labels, you can write a filter such as: “labels.env eq prod” which will only return instances that have the “env” label set to “prod.”
$ curl --header "Authorization: Bearer your-oauth-token" https://www.googleapis.com/compute/alpha/projects/your-project-id/zones/your-zone/instances?filter=%28labels.env+eq+canary%29+%28labels.tier+eq+backend%29
{
"items": [
{
"name": "vm42"
"labels": {
"env": "prod",
"tier": "backend"
}
}
]
}
Now that you know how to create labels and filter by them, you can use labels to better manage your resources on Google Cloud Platform.
Happy Labeling!
-Posted by Rae Wang, Product Manager, Google Cloud Platform





0 $type={blogger}
Post a Comment
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.