How to get started with Google Cloud Client Libraries
Key Takeaways
The video demonstrates how to get started with Google Cloud Client Libraries by installing the Google Cloud CLI, setting up application default credentials, and making a cloud client library call using Python. It covers the basics of cloud client libraries, including authentication and configuration.
Full Transcript
Cloud client libraries. In the last episode, I talked about what they are and why they're so useful. I told you about how they significantly reduce the code that you need to write and handle all those low-level details like authentication. Now, [music] let's get a little bit more hands-on. We're going to set up an environment, get application default credentials configured, [music] and make our very first cloud client library call. This is what's what with cloud client libraries. If you're developing with Google Cloud on your local machine, you'll need to install the Google Cloud CLI or G-Cloud before you can access Google Cloud services. The Google Cloud CLI is part of the Google Cloud SDK. Not only does it let you manage Google Cloud resources from your terminal, it also handles authentication for your locally running application code. The instructions for installing the Google Cloud CLI vary by operating system, so I've linked instructions in the description. For the demonstration I'm about to walk through, I already have the CLI installed, just not configured. So, I've got a cloud storage bucket and I want to return a list of all the files that I have stored in it. Here's how I can do that with Python. Now, before I can run this, I'll install the dependencies with pip install. Rather than a single massive library, Google Cloud client libraries are split by service. Since I'm accessing Google Cloud Storage, I'll install the corresponding client library, Google Cloud Storage. You'll see this pattern for most of the services. Google Cloud compute, Google Cloud Secret Manager, and so on. This approach means you'll only install the code that you need, keeping your application light and clean. Let me do a quick rundown of the code here. First, I import the library for Google Cloud Storage. Next, I instantiate the client. The client is the main entry point for any subsequent calls to the API that I make in my application code. After that, I construct a request which in this case only requires the name of my GCS bucket as a resource path. And now the magic happens. The request is sent to Google Cloud using the list objects method of my client. And since the results are returned as an iterable object, I have a loop to simply print out the name of each object in my bucket. I'm going to run this now just to show you what happens. Like I mentioned before, I installed the Google Cloud CLI, but I haven't configured it. So, as expected, I get an authentication error. Our application doesn't know anything about who I am and what it's allowed to do on Google Cloud. To fix this, I need to get application default credentials or ADC for short. Application default credentials are a standard automatic way for your application to find the right permissions to talk to Google Cloud APIs. There are a few ways to provide your application with these credentials, but for local development, I'll show you the most straightforward approach. Run g-cloud o application-default login. This command opens a browser for you to sign in with your Google account and then creates a local credential file in a well-known location on your file system. You might receive a message like this one warning you about a missing quota project. Well, the quota project is a Google Cloud project that is responsible for billing and usage limits of an API call. I'll talk more about quota projects in a later video. This particular example doesn't need one. So, I'm going to keep going and run the code. Notice again that when we create the client, we don't explicitly provide any credentials. This is the magic of application default credentials. My code will automatically find the credentials I just set up and use them to authenticate to Google Cloud. And there we go. Now that I'm authenticated with my application default credentials, the code runs and I've got a list of my files right here. I didn't have to change a single line of my Python code to indicate credentials or other authentication details. With a single G-Cloud command, I configured my local environment and the client library automatically picked it up. That's the power of this approach. Now this is a very brief overview of how to get started with cloud client libraries with a very simple example as a preferred way of providing authentication to cloud client libraries. Application default credentials are an important [music] concept to understand. There's more to talk about there. So catch the next episode while I'll cover where your application is looking for those credentials, what they look like, and more. And as always, if you have any questions, feel free to drop them in the comments. Thanks for [music] watching. See you next time. Heat. Heat.
Original Description
What are Google Cloud Client Libraries? → https://goo.gle/4jb0mBg
Install Google Cloud CLI → https://goo.gle/48MbOjd
Guide: Set up Application Default Credentials → https://goo.gle/4qgPioe
In a previous episode, Googler Roger Martinez explained what Cloud Client Libraries are and why they’re so useful. Now watch along as Roger demonstrates how to set up your environment, configure Application Default Credentials, and make our first client library call.
Welcome back to What’s What: Cloud Client Libraries.
Watch more What's What → https://goo.gle/WhatsWhat
🔔 Subscribe to Google Cloud Tech → https://goo.gle/GoogleCloudTech
#GoogleCloud
Speaker: Roger Martinez
Products Mentioned: Cloud Client Libraries, Google Cloud Command Line Interface
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Google Cloud Tech · Google Cloud Tech · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
I’m going for it #GoogleCloudCertified
Google Cloud Tech
I had to get #GoogleCloudCertified
Google Cloud Tech
Be better overall at what you do #GoogleCloudCertified
Google Cloud Tech
Cloud Monitoring on our radar #Analysis #Uptime
Google Cloud Tech
Introduction to Generative AI Studio
Google Cloud Tech
How to use Github Actions with Google's Workload Identity Federation
Google Cloud Tech
Introduction to Responsible AI
Google Cloud Tech
Networking updates and CDMC-certified architecture
Google Cloud Tech
Create and use a Cloud Storage bucket
Google Cloud Tech
How to digitize text from documents
Google Cloud Tech
Faster analytical queries with AlloyDB
Google Cloud Tech
Next ‘23 sessions and FaaS Wave
Google Cloud Tech
Introduction to Assured Open Source Software
Google Cloud Tech
BigQuery Cost Optimization: Storage
Google Cloud Tech
BigQuery Cost Optimization: Compute
Google Cloud Tech
BigQuery Cost Optimization: Select Queries
Google Cloud Tech
Remote Field Equipment Management with Manufacturing Data Engine
Google Cloud Tech
Supercharging your applications with Cloud SQL Enterprise Plus
Google Cloud Tech
Vector Support on our radar #GenAI
Google Cloud Tech
Architecting a blockchain startup with Google Cloud
Google Cloud Tech
Kubernetes and multitasking updates!
Google Cloud Tech
GKE: Using Kubernetes Events
Google Cloud Tech
How to configure firewall rules for Cloud Composer
Google Cloud Tech
Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Google Cloud Tech
Geospatial analytics on our radar #EarthEngine #BigQuery
Google Cloud Tech
Ensuring requests are set in Kubernetes
Google Cloud Tech
Cloud Next 2023, Google research program, and more!
Google Cloud Tech
How to migrate projects between organizations with Resource Manager
Google Cloud Tech
How to run #MySQL in Google Cloud
Google Cloud Tech
#GenerativeAI for enterprises and #Next2023
Google Cloud Tech
How Google Photos scales to store 4 trillion photos and videos
Google Cloud Tech
Google Cross-Cloud Interconnect (Demo 2)
Google Cloud Tech
GKE Cost Optimization Golden Signals: Introduction
Google Cloud Tech
GKE Cost Optimization Golden Signals: Workload Rightsizing
Google Cloud Tech
GKE Load Balancing: Overview
Google Cloud Tech
GKE Load Balancing: Best Practices
Google Cloud Tech
Disaster Recovery in GKE
Google Cloud Tech
How to configure IP masquerade agent in GKE Standard clusters
Google Cloud Tech
Enable and use GKE Control plane logs
Google Cloud Tech
Compliance in Australia with Assured Workloads
Google Cloud Tech
Creating budgets and budget alerts in Google Cloud #FinOps
Google Cloud Tech
Cloud SQL Enterprise Plus on our radar #mySQL
Google Cloud Tech
What's Next for Google Cloud?
Google Cloud Tech
How Loveholidays scaled with Contact Center AI
Google Cloud Tech
What is fleet team management in GKE?
Google Cloud Tech
Troubleshoot VPC Network Peering
Google Cloud Tech
Introduction to DocAI and Contact Center AI
Google Cloud Tech
Cloud Run Direct VPC egress explained
Google Cloud Tech
Database deployment options in GKE
Google Cloud Tech
Analyze cloud billing data with #BigQuery
Google Cloud Tech
Tips to becoming a world-class Prompt Engineer
Google Cloud Tech
Serverless is simple. Do I need CI/CD?
Google Cloud Tech
Accelerating model deployment with MLOps
Google Cloud Tech
How Hawaii's Department of Human Services scaled with CCAI
Google Cloud Tech
Pricing API on our #Radar
Google Cloud Tech
How Recommendations AI for Media can boost customer retention
Google Cloud Tech
Troubleshooting: Node Not Ready Status
Google Cloud Tech
One weekend until Cloud Next 2023!
Google Cloud Tech
#GoogleCloudNext starts tomorrow!
Google Cloud Tech
#GoogleCloudNext will be demand!
Google Cloud Tech
More on: Tool Use & Function Calling
View skill →Related Reads
📰
📰
📰
📰
A lightweight workflow for keeping up with AI conference papers
Dev.to · Daniel
Why CitedEvidence Believes Great Researchers Read Less Than You Think
Medium · AI
How to Write a Literature Review That Actually Argues Something
Medium · Machine Learning
I Built a Personal Paper Engine to Stop Losing Research Papers
Dev.to · Ethan
🎓
Tutor Explanation
DeepCamp AI