Cloud OnAir: Build Your First Serverless Application With Google Cloud Functions
![Cloud OnAir: Build Your First Serverless Application With Google Cloud Functions Cloud OnAir: Build Your First Serverless Application With Google Cloud Functions](/pic/cloud_onair_build_your_first_serverless_application_with_google_cloud_functions/TUNuZ1ZSeWZyS3c_.jpeg)
Welcome. To cloud on air live webinars, from Google cloud we, do these every week, so be sure to come back next week and see all the great things you can do with Google cloud my. Name is Bret McGowen and I'm gonna be talking about building, your first service, application, with, Google cloud functions. We. Will have Googlers on standby, to answer your questions so feel free to submit them through the platform as we go. Let's. Get started what, is Google cloud functions, cloud, functions are these. Functions of code that run automatically. In response, to events in the cloud so, these could be explicit, Google cloud platform events. They could be HTTP, events and more, and broadly. This category, of compute is called functions, as a service, or faz, but. Let's, back up a question and a back up a minute ask the question why. Functions, not applications, we've been building applications, for a long time so, why do we want to deploy just individual. Small snippets, it sounds like a lot of work well. Let's rewind a few. Years ago when we were running all of our software in datacenters either data, centers that we owned or maybe, we were co-locating. In some hosting. Provider we, had shared machines, and that's because servers were expensive, and to get a new server you had to purchase one and had to get shipped and set up so, to optimize, we would put multiple, applications, and multiple. Services, on the same physical server and this, worked ok but. There were some issues for, example if your services, had conflicting, dependencies. Maybe, third-party, libraries, or frameworks they. Could conflict and interact with each other and moreover, if one, of your services started, using too much CPU, or Ram or disk space it could impact the performance of other services, on this same server. So. Then virtual machines came along and this, is great because you could basically give a whole operating, system to each service and it could do whatever it wanted install, whatever dependencies. Have, whatever framework versions, and that's, great but. It's still a lot of overhead to manage an entire operating system just, for one small service, and it, takes a while to boot, up a virtual machine sometimes, minutes in some cases, so. Then Along Came containers. And this, is great because the same fundamental, operating, system kernel is shared, across multiple services. Even, though within the container each application, or each service thinks, it has its own OS and there's, some great ways using, your container configuration. To, define. What is your runtime environment, what operating system what, libraries. Would modules, but. There's still a lot of management. Involved, in that you have to see how, many versions of this or how many copies. Of this container do I need is.
Are, They up and running how do i reboot them how does networking, work who's connecting, disk, space there's, still a lot of infrastructure. Management, so. Then we move into the world of platform-as-a-service. And then ultimately functions. As a service and somewhere. In the spectrum, we get into the world of what we call serverless, which, we'll talk a little bit more about later but. The basic premise of service server lists is you just write your code and deploy it and that's all you need to, worry about, but. Still why. Functions, what's, the advantage we get but just having functions, well. Let's talk briefly about micro, services, and micro, services is a huge, deep, topic, that we could talk for hours about but, just very briefly. Imagine. You have a typical monolithic. Application, the, kind of app we've written for years and years let's, say it's an e-commerce application. It has all these sub components, and sub modules, so things, like a pricing service or credit, card payment processor, authorization. Service all the things you need to run an e-commerce website, so. We want to move these out and extract. Them into their own micro. Services, but. Why what's the advantage so. One, advantage is independence. Of scale if one, of your services say the, authentication service, needs, a lot more resources, or different types of resources, than the rest of your application, extracting. It into its own micro service lets you scale it independently. So instead of having to scale up and scale down your entire application, you. Can just scale one, particular, service, similarly. If other, services, have different, release Cadence's or release cycles, so, say your credit card payment processing, service is really delicate it handles money you, only want to update that maybe once a month but, maybe you're pricing. Service you want update everyday as you experiment with new pricing models and discounts, and so forth you don't want to have to necessarily deploy. Those at the same time so, making them independent lets.
You Scale them independently, they. Lets you release them in different Cadence's, and different release cycles and also, lets different teams work on them it's really a great way but. When. You extract a micro service you now have all the management, overhead, of maintaining, a bunch, of smaller services, things, like infrastructure, networking. But, that's where serverless comes in so, some principles, of server lists are invisible. Infrastructure, again, you just worry about writing your code and the, cloud provider takes care of scaling, it up scaling, it down load balancing, updating. The operating system and all of that and it. Scales for you so not only up as traffic, goes up but down and scales. Down to zero which, means if your, code is not actually, running you, don't pay anything and this is great for applications that have spiky, or unpredictable. Traffic, patterns it's really cool. So. Now let's talk more specifically, about cloud, functions. So, you can use cloud functions, to create these independent, microservices, like we just talked about but, you can also use them as what I like to call cloud glue, so, as different, third-party or, Google cloud platform services, and, events, happen you can use cloud functions to sort of glue them together into a chain of events really. Naturally, and really easily and we'll take a look at some examples in a minute. So. There are two types of Google cloud functions, there are what we call background, functions, which, are asynchronously. Invoked, functions, that, run in response, to events in, Google, Cloud so, for example cloud, storage, which is our binary, or blob file storage, system, you. Could upload a file to cloud storage and a cloud function can automatically. Run in response, to every file. Uploaded, and because, it's auto scaled and server lists whether, you're uploading one file at a time or a thousand, files at a time, cloud functions will scale up the compute you need charging, you only for the precise, compute, that you're actually using, pretty, cool cloud. Pub/sub which is our, asynchronous. Messaging, system in Google Cloud you can have a cloud function that runs in response, to pub sub messages, that come in and I'll talk a little bit more about that later in. Firebase, which is Google clouds mobile. And web. Platform. In SDK which has a ton of events so, a bunch of firebase events can actually trigger cloud functions, as well in, addition. To background functions we also have HTTP. Functions, which, are synchronously. Invoked over, HTTP. So you can do things like create, an API endpoint, or use. Them as web hooks and this is a great way to integrate with third-party services. So for example, a credit card payment processing, service when, a payment is processed you, could supply your, cloud, function as a web hook and it can evoke it when it's done with the payment. And. You. Can use cloud functions, to create actions, on Google which, is our way of building apps for the Google assistant, and Google, assistant, if you don't know as Google is a smart agent, and it helps you do everything from order. Food for delivery to check the weather play music and more and it's, available on over 400. Million, devices. Everything. From the Google home smart, speaker, to, virtual. Reality headsets to tablets, to Android, phones iOS, devices and more, and cloud functions is a great, way to build apps for the Google assistant. What's. The environment that cloud functions runs on nodejs. 611. Five currently. More, languages, are coming, we've, got image magic pre-installed, so if you need to do any image manipulation or, processing. It makes it really easy that, binary is already provided, if. You have your own binaries, you can either upload them as part of your source code or you. Can take advantage of nodejs native. Modules to do your build in the cloud and, a. Cool feature is that they are automatically. Authenticated, to other Google, services, and api's, so, if you need to do something like call out to the Google translation, API you, don't have to worry about supplying, API keys or. Service. Accounts it's all automatically, authenticated, by default for you. So. Let's talk a little bit about HTTP. Functions. And what, they look like so. Here's an example really, simple at your basic hello world right, you just create a, function, in JavaScript called, hello and it has two parameters request. And response.
Request. Is the data that's coming in from the user and response. Is what's being returned to them so, you can directly do things like set HTTP, status code 200 okay, and send, a message back to the user if, you've, written any Express, for nodejs, you'll recognize this pattern because, it is using Express j/s under, the hood but. One thing I want to point out is that with just three, lines of code and, no additional configuration. You automatically. Get a fully, qualified domain name an, HTTP. Endpoint and an SSL, surgeon, rated for you without any other work so, it's a really easy way to deploy an HTTP, endpoint. Automatically. That scales and has sub second billing. Just. Want to talk a little bit about some, automatic, request, parameter. Process, parsing, so. Cloud. Functions will look at your, query string for example or say, you're building an API a REST API and, you want, to handle an HTTP, POST well. Cloud functions will automatically, parse the, body of your post so, if it's JSON you can access it at request body, dot property, or request, query, dot property for, query string values. But. Let's, take a look at a demo. So. I wanted to do something a little bit more complicated than hello world so, we're gonna do hola world which is an internationalized. Version, of hello world so, in just a few seconds we're gonna create a hello, world application that, can say hello world in any, language, I'm gonna, go ahead and start the deploy because, sometimes it can take a bit a few, seconds so I'm gonna do g-cloud which is our command-line, utility, for interacting, with Google Cloud so. G-cloud functions, deploy, I'm gonna name the function hola world and I, wanted to be triggered by HTTP. So. Let me go ahead and start that and. While. That's deploying. I'm. Gonna talk through the code very briefly so. Here I'm going to reference, the, Google, Cloud translation. API so, we have a set of nodejs, npm modules that wrap a bunch of the api's in google cloud like our vision API translation. Api and more, and this just lets you interact with it nicely. In very no js' friendly way and, you'll notice we don't give it any service, account we don't give it any API key it's again, by default automatically, authenticated, to our cloud project, here's. The request and the response object they talked about before so. If the user gives us a message in the query string will use it if not will default to HelloWorld if, they give us a language in the query string we'll use it and if, not will default to Spanish, here, we'll actually invoke the translation API return. Status 200, okay to the user and then send back the translation, and for. Dependencies, we just use the natural nodejs. Package, JSON, format, which is how you define dependencies, and again because we do out the build in the cloud, you only need to deploy these two files package JSON an index and we'll. Do the build for you in the cloud when, we deploy, so. You can see that it's done deploying let.
Me Show you a couple of commands so g-cloud functions. List this, will show me all of the cloud functions, that I have in my project, and here's, hola world that we just deployed so, I'll do G cloud functions. Describe. And we'll see some data about our function. So. You can see things like what version it was when it was deployed we, set the timeout which by default here, is 60 seconds, you. Can see that it uses 256. Meg's of RAM and you can configure how much RAM and memory is available to your function and that affects pricing, the more memory you allocate towards it the more expensive your function will be when, it runs but. For this case here is the URL that again was automatically, generated for us so, I'm gonna copy that and then let's curl it and see what it does again. By default we, were looking for hello world and I'll translate it to Spanish so, let's see what happens. Hello. World hola mundo so that's great so now let's actually do a different message let's give it the message of hello, and I'm gonna do some manual URL, encoding here hello, friends, and then the language will, be let's. Say French. Motorola. Me and. What. About Japanese. I don't, speak Japanese so I hope that's right German. So just like that we created a global hello, world function. In, cloud functions. All. Right so those are HTTP, functions, so now let's take a look at background, functions. So. For. Example you can listen to events on Google Cloud storage. So finalize. Delete, archives, to finalize is when a file is finished writing so say on a new write our a, replacement or an update delete is obvious and, so forth how, you deploy them similar to an HTTP, function g-cloud, functions, deploy the name of your function you give it the resource which is the cloud storage bucket you want to listen for changes on and then what type of event so in this case we want to listen for a finalized, event. Let's. Look at an example of this in action, so.
Cloud Storage I'm gonna upload a, picture of an adorable baby raccoon, I love, raccoons so I tried to find the cutest possible, image and this is that so. When I upload this image it's, going to trigger a Google cloud function, to take some action, in this, case I'm gonna submit it to the Google cloud vision, API to. Do some analysis, here. The vision API will tell us what is this a photo of and you, can see here that it's 99%, confident, that it's a raccoon but a hundred percent confident, that it's adorable and. Here's. Where it architecture might look a little bit different, in a cloud functions, world versus, a traditional application. So. If you wanted to do some additional, processing besides, just, run and call the vision API we. Might typically in the same cloud function call the vision API and then, take our next step so for example if, we wanted to create multiple, versions, of our image so a small, version for a phone or a large version for desktop, medium, for tablet etc we, could do it in the same cloud function, either. Linearly, or maybe, potentially, create, different threads one to do the vision API one, to do the thumbnailing. But. In this in our world we actually can create a totally, separate cloud function that, triggers off the same file event. Independently. Creating, those thumbnails so this is sort of the microservices perspective, where these two functions are totally, unrelated they don't know anything about each other you can deploy them differently you can scale them differently. Without. Having to intermingle that code, so. Let's take a look at that, same demo in action. So. I have here my cloud storage, bucket which, is currently empty so I need to upload a photo, and I figure the best thing to do is clearly, to take a selfie in front of you so, I'm gonna take a live photo let me get down here and pose. And we'll see what the vision API has, to say. All. Right let. Me drag this into cloud functions. You. Can see it doesn't upload sorry, drag. This into cloud storage, so. There's our photo so, that was the in bucket so now we're gonna go down to, the out bucket, so, we're gonna see what does. The vision, API have to say and was it able to create a thumbnail so. Thumbnail, here yes we have a tiny version of our thumbnail but, let's look and see what. The. Vision API had, to say make. This a little bigger so you can see, so. From my photo it said finger. Chin, hand, thumb, professional. Well that's a little questionable sign. Language I guess maybe because I was doing thumbs up and facial, hair and if, you're curious about the vision API it also has these confidence, scores so it's 89% confident, that I have a finger well that's good to know. All. Right what did the code look like it's a little bit different than, the HTTP. Function which had a request and a response object. The parameters. Because. These are our background, or asynchronous, functions we can't directly respond to it instead, we get an event object and the, event object has two properties, one is called context. Which, describes, what, kind of event were responding, to is it, a cloud storage event, is it a pubsub, event is it a firebase event and so forth and the. Data event describes, the data specific. To this event so, in this case because, something is happening in cloud storage it's, a file object and we have different properties like file name well bucket it came from and so forth here. We'll submit it to the cloud vision API to. Get back response, so it can give me things like thumb. Or sign, language or, professional. And. Now I'm gonna talk about another source of events for something called firebase I won't, dig too deep into firebase, because it's a huge topic and it does a ton of great stuff but, if you don't know firebase, it's a cross-platform, set. Of tools for building applications, mobile, web, and more and there, are SDKs for Android. For iOS for. Web there's, a unity plugin for a CTR plugin for unity games and a C++ plugin for embedded devices and there, are a ton of tools in firebase everything, from the brand-new, fire store database, to, the classic, real-time database, authentication. Events there's, a static file hosting. Messaging. Remote. Cloud. Test, lab full of Android, devices in the sky and so much more and you. Can actually trigger cloud functions, based, on several of these, events, so for example the, cloud, fire store database you. Can watch certain, locations. In the fire store database and run, a cloud function automatically, when something happens a write event an insert event delete and so forth so, you could say a new value has been written to the database let. Me take some action, like data, validation, make sure it's the right format or maybe I want to replicate this value to another database maybe some analytics.
Database That have some data warehouse tool, you. Can also plug into firebase, authentication events, Google. Analytics events if for firebase if you don't know Google Analytics or firebase think the, traditional Google Analytics that you maybe be used on websites but, for your mobile devices so you can be tracking sort, of events. As your user moves, through your mobile app and when, certain events trigger you can have a cloud function, run in the cloud in response to that pretty, cool. How. Do you deploy cloud functions, you. Can deploy from the command line like I did earlier using the G cloud command, line tool you, can write. It directly in your browser if you want this always kind of terrifies me but if that's into you if you're into that super easy just browse there in the Google Cloud console. UI and you can edit your code directly. And you, also could just interact with the cloud functions, API directly maybe, you have a CI CD, system and you want to automate. It as part of your workflow whatever use case is the, API can support, it and. We. Also, have a local emulator. Now, this is nice because you can actually use the tools you're already used to for writing code and, set. Breakpoints and, watch points so you can watch local values step, in and out of functions all the nice normal, debugging. Tools you're used to using, you can do through the local emulator to make sure your function is in good shape before, you deploy it up to the cloud. So. What are some use cases that we're seeing people use cloud functions for things. Like web hooks which I talked about integrating, with third-party services, so when, commit happens and your github repo it could invoke your cloud function, when, your. Temperature, goes up in your house it could invoke a temp cloud function there was some smart device API. Endpoints, whether you want to create an API for your personal, application, or your internal application, or if, you want to create a public API for, external. Developers, and users to consume you can do that with cloud functions. Lightweight. Data transformation. So, we sort of did that with the photo upload it. Takes some image some binary, data does, some processing maybe writes it to a database but. Also think about a use case like uploading, a CSV file, to cloud storage your, cloud function could run process. The data in the CSV file clean, it up munge it put it in whatever format you want and then maybe write it to a real database so like cloud fire store or Google. Bigquery and. Then. IOT, devices cloud. Pub/sub is our messaging, asynchronous, messaging system that, can scale up to thousands, and millions of requests, at a time so, if you have a bunch of IOT devices they're all streaming, their data temperature. Location, whatever into pub/sub you, can have cloud functions, run in response, to, those messages as they come in in fact, we have a whole set of tools called, cloud IOT, core that, addresses, this so if IOT is interesting to you check out cloud IOT core on Google cloud platform and. Finally. I'm a developer I've written applications, my whole career so I tend to think of how can I use cloud functions, to write and build apps but, it's also great in sort of a DevOps context. If you have infrastructure. That you want to manage you can do it with cloud functions, because, you can have cloud functions, watch, your. Logs, of your Google cloud platform project. And it, can do things like oh I saw this app crash. 10, times on this, server I'm just gonna automatically, reboot the server or oops. I saw a delete event for my server my, database server that's, no good let me notify someone or maybe, a user was added, removed from, some admin pool so take some action maybe you let someone knows that a human can double check it so, in a way you can use your server list tech to manage your servers your traditional infrastructure pretty, cool.
How. Our car is how, our cloud functions being used today here, are some actual customers, so companies like meetup smart parking home away and Turner so. Our parking has a really interesting use case they're building a platform for smart cities which. Means they do things like track, how many cars, are moving, downtown and, change the way the traffic lights work based on those traffic patterns and they, use cloud functions dozens, and dozens of, cloud functions, all these, independent little micro services to handle that and, cloud, functions actually is nice for their use case because they've really, uneven. And spiky, traffic patterns so think about the use case where in rush-hour, downtown, you have a bunch of cars all moving around but, maybe a three o'clock in the morning it's completely, quiet what. Cloud functions will scale directly. To the workload and the use case or the usage of those. Devices. Turner. Also for example uses, it for, a, health. Check monitoring. For a lot of their brands on their online brands, things like make sure your uptime is good and it's performing, well and. Then of course we've got companies doing a lot of work, on business. Intelligence and analytics. At. BOTS and also similar to like, Google home and actions on Google. So. Finally I want to wrap up with how. Do you go beyond the hello world what are some of the tools available and, strategies, for, creating more, complicated. Apps and specifically. I want to talk about how do you chain, multiple, functions, together and how. Do you handle monitoring, and error reporting which is really important when you want a production, grade system. So. Let's talk a little bit more detail about cloud pub/sub as I, alluded to cloud pub/sub is our fully managed. Asynchronous. Message, delivery system and it lets you connect different. Applications, together using, messaging it. Works over HTTP, and G RPC, and just think of it as a way to throw, a bunch of JSON at. A service in the sky and endpoint that is able to absorb and request, and. Send out. And, deliver those messages based, on topics. So. Let's look at this in action so. Say you have a system for onboarding, new employees, the, first thing that happens is a employee, record, is written to the database in this case let's say Cloud firestore, so. Now you want to take some action I want to off of, that insert. The user into say our HR, system, now. Say that's a dependency. On a next, step in the chain so, we can't just automatically, move, on with the next step we need to wait until the user is finished, being, inserted into the HR system before. We can do the next step so. We could just go. On and do additional processing, in this same cloud function, or you, can wait once the user is inserted, in our cloud function we, can publish a message, a JSON, message to cloud pub/sub saying. Okay we've created a new user our topic is new user here's the relevant information about, the user and now whatever other steps in the chain that, need to take action, based on that can, spring into action because. Pub/sub. Will deliver it there's. The natural integration, with cloud functions, which will automatically, invoke if you have it listening for example on the new user topic, and. It could do something like insert. The users badge ID into the the badge system for the building, but. Because pub/sub, natively, talks HTTP. Integrating. With third other third party services. Is pretty easy so say you have an IT help desk system that, speaks HTTP, it, can actually directly, subscribe, to pub/sub on and, receive that same message on the same topic and take, another action so for example, create, a ticket for someone to go set up the user's desktop in this. Way pub/sub, lets you create really complex and really flexible, workflows. As you send messages throughout, your system. And. Then. Finally I want to talk about monitoring, and error reporting so. Again these are crucial pieces for, building a production grade, application.
We. Have a tool in Google cloud called stackdriver, and there's a tool called stack driver logging, and this basically contains all of your logging across, all of the tools in Google cloud platform and, to, take advantage of it you don't have to do anything it's, automatically, baked in with cloud functions, it, will capture all of your console, log messages, and if, you're not in nodejs to just, know that console.log. Is your, standard print, line print out to the console, it, will map log messages, and error messages, to the appropriate, severity and, stackdriver. Logging, is really powerful you can do things like text searching, drilling. And setting up filters I'll show you a screen shot in a second, and there's. Also stackdriver airing, error. Structure. Error reporting which will, automatically. Spelunk, those log messages to surface errors to you and. Because. Cloud functions, is build on precisely. How, long your function runs and how, much memory you've allocated to it we of course capture. Usage metrics on how long as your functions are running and how much memory they're using. So. Here's a screenshot of stackdriver logging, and you can see there's a whole bunch of log messages, from our cloud function, so. You can do free text searching like I said or filtering you also can drop. Into one specific. Request. ID and see all the logs for, one specific invocation. Of the cloud function, and this is useful because if you have a bunch of cloud, functions identical, cloud functions running at the same time and you maybe have an error in one specific invocation. This lets you group all of those into one to further aid in debugging. And. In, stackdriver error reporting, so, this will coalesce, essentially. With, some intelligence errors. That are happening in your educator, application, so, you don't want to get an email or an alert every single, time the same error happens you want to gets a one error email, that says this, error has happened ten times today or some kind of roll up so, this has some intelligence, built in and again is all automatic out-of-the-box, it's, all turned on for you you just have to start using it. So. A couple of things to consider before, using cloud functions. One. Is, if, I, have an existing, application can. I just move it to cloud functions, and the, answer is usually, not and that's because cloud functions, are designed to be ephemeral remember. These are little functions that spring, into life they, run for a little bit and then they die off. Traditionally. When you write applications we assume that once the app starts it's just it's up and running until. We, shut the server down but. These are springing into life dying, off all time so we have to do things like manage, our state in a. Cloud service, that is designed, to manage state so something like a cloud sequel database or cloud firestore. Moreover. We, can't make assumptions that anything, we do in one. Invocation, of the function is still, happening the next time so for example if I write a file to disk the. Next time I function invokes, that file may or may not be there it just depends, on whether, it happens to use the, same, particular instance of your function so. You can do things like cheats with some optimizations, but you have to write it to assume that, it's stateless an ephemeral. Long-running. Compute tasks so if you have to do things more, than nine minutes there's a nine minute at maximum currently on cloud functions. Running. It directly, in college functions is probably not a great fit instead, what you want to do is run your long-running, work on something, like kubernetes, or Google compute engine which are our virtual machines and use. Your, cloud functions, to do the orchestration, so things like create. A send a message to pub/sub to kick off the process handle. The. Finalization. Pub/sub, message when it's done doing the processing and just use cloud functions for general orchestration. Of your workload if they're long-running and, then. Guaranteed, response times so, one. Of the advantages, of cloud functions, is that it only builds, when, you're, actually running. Your code but. The downside to that is because it's put everything to sleep that next, request that comes in may, take a bit to sort of spin up some resources and it's not long maybe like think of a second or two and for, most use cases that's, totally, fine but, if you need likes millisecond.
Type Response, that. Is not something we can really guarantee with cloud functions every once in a while you'll hit this what we call cold start. We. Have a whole set of cerberus, tools on Google cloud I'm not going to go into these now, because we're about out of time but, if you go to cloud google.com, slash server list you can check these out just. A, quick note about pricing, before you wrap up I alluded. To it earlier pricing, is essentially, based on a few factors including, how many times your functions are invoked how long they run for how, much remember you've given them and what your outbound networking, traffic is but. The important thing is you get two million, in vacations, every month, for, free with, our free tier so it's a great way to not only try out Cod functions and see, if it's a good fit but you can actually start building real applications. To million a month is a lot. Here. Are some resources if you want to get started today cloud. Google.com. Slash, functions, we actually just launched, the redesign of this website just, a few minutes ago so, be sure and check it out you'll see my smiling face in a video there we've. Got a bunch of new documentation, tutorials. And. Then, also join us on Stack Overflow and github to get started. If. You have questions in the future you can follow me on Twitter at bressant, MCG but, we actually have been taking live questions during, the webinar so, give. Us less than one. Minute and I, will be right back to, answer your questions, stay, tuned. You. All. Right so we have a few questions that we've taken during the webinar the. First one here is there, a serverless, option if I have already have an existing, application so. There are a few perches, you can do one, as. We kind of talked through the microservices, example, you, can identify parts, of your existing, application, that might make sense to extract, and put, into a cloud function. This. Requires some rework, and some rethinking of your application, but, it's a strategy that a lot of companies and a lot of projects are doing however. If you want to try and just lift, and shift an existing, application that you have we, have a product called Google App, Engine standard, and this is a server list platform, as-a-service so.
If You have a PHP, Python. Java or. Go application. You actually can just put it on App Engine and it has a lot of the same characteristics, as cloud, functions, it scales down to 0 which means it goes to sleep when you're not using it it scales, up as needed and it's fully managed so be, sure to check out Google, App Engine. The. Next question will, cloud functions, be multi-region. Absolutely. So right now as, of this webinar cloud functions is in beta and. It's only in u.s. central one but. When we get out of beta and into GA which. Should be happening soon we. Will be multi region including regions in Europe as well so stay tuned. The. Next question are other languages coming to cloud functions, absolutely. I like, to joke that right now we, use nodejs, and, JavaScript. Is the one true language so, why would you need any other languages, but, believe it or not folks, disagree with me and are asking for languages like Python, and Java and so forth so we're absolutely working, on it as, we speak so it will be coming but. Probably not until we go into GA. The. Next question I have will. Cloud functions, support, more. Providers, in the future yeah, absolutely so when we launched, it was just cloud storage, and just cloud pub/sub and. Now we have a whole bunch of integrations, with different firebase events so from cloud firestore the real-time database off and so forth so we are actively working on adding, more providers to, cloud functions, so stay tuned a. Next. Question what's the difference between cloud functions, and cloud, functions. For firebase it's a great question, the, short answer is it's the same product and the same service, but, when you use cloud functions, through firebase, there's, a, set of tools specific. To firebase, that kind of nicely wraps. Firebase. Specific, events and sort. Of matches, the firebase development, model, a little bit different so, the same underlying application. Infrastructure. Is powering both. Cloud functions, and cloud functions for firebase but there are a couple of difference differences, mainly in the sort, of way you declare. Your function and define it pretty small differences. But. They are slightly different and then, also how you actually, deploy your, functions so, if you're right doing a faqad function without firebase, you, use the g-cloud command line tool like I did in the demo if you're, writing it for, firebase, you use the firebase command line tool to do a firebase, deploy so. There are a couple of small differences but it's the same fundamental, product. Next. Question I see can I use Apogee, with cloud functions, absolutely. If you aren't familiar with apogee apogee, is essentially, our enterprise. It. Does api gateway, type functionality, as a whole bunch of things you can do around. Setting. A layer in front of your cloud functions, to, create an external API so you can do things like create service. Accounts for users API keys, they. Can handle URL, routing so based on different rules you can you can define, things. Like handling exponential. Back-off if it seems like a big. Load coming in so you absolutely can, use Apogee with cloud functions. Apogee. Is a Google company but. As of now there's no there's, no native, integration with cloud functions, you have to set up an Apogee. Configuration. And sort. Of manually, wire in all your cloud functions URLs now. The nice thing about that though is if you do with Apogee you can have some URLs go to call it functions you, can have some go to say, a Google App Engine instance maybe, you have something, running on-premise, you, can kind of mask all of that URL routing and rerouting, behind, the apogee configuration. So be sure to check that out. Ok, those, are all the questions that we have thank you so much for, tuning in be, sure to stay tuned we have next, session coming up called G, suite security, deep dive and this is going to be all about how you can protect Gmail against spam malware, ransomware.
Phishing. And more, and thanks, again for staying tuned. You.
2018-05-28 04:25
Great Thanks man
Why would I use GCP Functions when triggers cost double other providers and usage rounded to the nearest 100ms whereas Azure rounds it to the nearest 1ms?
Waiting for the Go functions