Submind YouTube summaries
Thumbnail for Cloud Made Simple with Serverless Python

Cloud Made Simple with Serverless Python

Watch on YouTube

Video summary

Belinda Venom, a developer advocate and software engineer, introduces serverless computing as the latest evolution in cloud infrastructure, moving beyond traditional bare metal servers, virtual machines, and containers. While earlier models required developers to manage operating systems, security updates, and hardware maintenance, serverless functions allow teams to focus entirely on core business logic by abstracting away the underlying infrastructure. This shift represents a trade-off where developers gain significant control reduction in exchange for increased abstraction; while this means waiting for platform providers to handle environment updates, it frees engineers from the burden of managing configuration and deployment pipelines, allowing them to concentrate on delivering direct value to users. The primary advantages of this architecture include automatic scalability and cost efficiency, as developers are charged only for the milliseconds their code is actively running rather than paying for idle server time. Serverless platforms excel at handling event-driven scenarios, such as sending a welcome email when a new user signs up or generating image thumbnails immediately after an upload, by spinning up instances to process requests in parallel and scaling back down instantly when demand drops. Furthermore, these solutions facilitate seamless integration with various cloud services like databases, IoT platforms, and AI APIs, enabling complex workflows where functions can be chained together via JSON inputs and outputs to react to specific triggers like new database entries or scheduled tasks without manual intervention. To illustrate these concepts, Venom presents a real-world case study of the "Weather Gods" mobile application, which uses serverless functions to deliver creative weather notifications based on location-specific events like hail or flooding. The application's backend consists of independent functions that query user locations, fetch weather data from external APIs, and send push notifications only when relevant conditions are met for specific users. This modular approach allows the system to scale independently; for instance, if thousands of users in one region experience rain, only the rain-processing function scales up while other functions remain idle, optimizing both performance and cost by ensuring resources are never wasted on unused capabilities. Finally, the presentation covers practical implementation details, including a live demo using IBM Cloud Functions with Python to analyze uploaded images for visual recognition tags. Venom highlights how simple Python scripts can be deployed to handle sequences of actions, such as reading database changes and calling external APIs, all orchestrated by cloud triggers. She also introduces libraries like Pyron and Chiron, which simplify parallel computing tasks for data scientists by automatically distributing workloads across clusters without requiring complex infrastructure setup, making advanced capabilities like 3D rendering or large-scale data processing accessible to developers who want to focus on algorithmic innovation rather than system administration.
Read the full video transcript
Linda venom she's gonna tell us about cloud made simple with serverless Python let's give her a round of applause okay perfect so my name is Belinda venom I'm a developer advocate and software developer and idea right now my current focus is on both cloud and server this prior to this role I was a software developer on the idea pop functions project which is based on top of Apache Oakland but it's kind of coming in based on top of Apache obelisk so who here has heard of server list um is anyone using server lists in their projects okay so less people anyone like projects and production server list okay so same people awesome today we're going to talk about some of the benefits of server lists and then we'll also check out our real life use these and then I'll show you guys a quick demo I'm running some Python code on a server list platform so um let's say I've been working on a project and I'm ready to play my code ops of it out to the top in the past me or someone else on my company might have needed to purchase bare metal servers to run my application on you have to manage the security updates for the servers and saw all the required software and keep the hardware up today then virtual machines came into the picture right we were able to let someone else like Amazon or Rackspace search and manage those machines for us when we just get a virtual machine to run our application you still have to manage the operating system and the software dependencies of your application but you didn't need a physically own or house those servers even more recently we've had containers enter the scene where we're only managing the application code and its dependencies we package everything up into a container we give a container to the closet to be running so that many things a lot easier but we're still managing some of the infrastructure here we need a manager on the right time than our own application dependencies building a container to run your application on is still somewhat manual process that could still be abstracted away so software developers really need a focus on that core business logic and not get distracted by infrastructure management configuration and these abstractions are ultimately what server lists or functions and service offerings are promising you so that execution environment for the code is provided for me as a developer and my code can just be run in response to events or in response to actions that I care about so I should know I'm positing this as an evolution but all these models are still available today and they might even still be the right choice depending on what problem you're trying to solve or what your requirements are I'm so you'll notice on the x-axis it says decreasing concern over your stack implementation but it's also decreasing control so if there's a security vulnerability or an environment update that you need to make you have to wait for the platform provider to make that required environment update so if you need that additional control one of the others might still be the right option for you [Music] so I think this is a really just another nice way to visualize the increasing of abstraction so as we're moving through each of the deployment models we're seeing less and less that the end user is responsible for so on the far left we have on front where you have your own machines and you're managing everything and then we go through infrastructure as a service platform as a service and then ultimately function does the service where you literally only write manage and deal with functions so these changing deployment models have also affected how we write and think about our application we used to write code as these big monolithic applications the entire operation gets appointed as one unit and in terms of introducing any new code changes needs a completely new deployment of the for the patient even if you're only changing one or two lines so from there we moved more to this microservices paradigm we started to break the monolithic obligation into various services that are communicating with each other over restful any ice in a store application for example you might have a micro service that manages the accounts for your users one for placing orders and watch for may be managing interactions with your shipping company so you can deploy each of those micro services either as an application on a like pad solution like a platform as a service solution or maybe you deploy each one of those micro services and generic containers and then finally as we move more towards instructions the service model there's been further decoupling and shrinking of the size of the unit of code so instead of creating micro services because just write functions that we want to deploy to the cloud and each of those functions have the goal of doing one theme and doing that one thing really well perhaps in reaction to a particular event so as I said server list promises they you can just spend your screen writing business logic that has a direct positive impact to your users and not focus on that configuration or management of themes even though it's called server list yes there are servers but the idea is you don't have to see them or deal with them so from a developer's perspective the functions of the service platform is going to provide a runtime and an execution environment for the code that they're writing so you just write the code and then the service platform runs it for you in the cloud on-demand and within milliseconds and this may be actually abstract it away from you so you typically won't see it but usually what's happening under the covers is the code is ultimately being run on a container and the cloud providers environment so one of the goals of server lists is to provide developers with scalability out of the box so let's say that you have a set of api's and you've represented each of those maybe I get points as different functions maybe you know suddenly your OP gets featured on reddit you have millions of requests from your UI chickies back in 80 I implements the only thing that's going to happen is that the platform will start on the multiple instances of the backend to process those requests in parallel and then kind of gives you that horizontal scaling for free without any additional programming or server management from you three starts about your code scaling out or up to n instances when it's required but also scales back down to zero when it's not being used so what that means from an app developers perspective is that you're not paying for the time that your code is not being run so you're only charged for the amount of time that the code is actively running they're doing some work you're no longer paying for that idle time you have to do the testing wait for your particular scenario but this can actually mean really big cost savings compared to having a server hundred percent of the time so it really just depends on the project depends on the workload but it can't be movie good cost savings other promises most server list solutions for right support for some kind of event urban scenario so this is literally anything where an event happens and you want to react to that by some code some examples like maybe you have a new user who signs up to your app that results in their information being stored in your customers database and then you want to execute some logic in response to that new database item so maybe send them a welcome email or do some processing of their input data if you'd like a user uploads an image to that maybe you want to generate a thumb as soon as I image is stored in their object store and you can do other things sentiment analysis on Texas a user who said by literally anything you just want your code to react to you or radicular event so typically serverless platforms are going to provide that infrastructure for you to easily react to those events with your code so many of the cloud pop-ups offer a number of different services you can integrate with your applications so these are things like artificial intelligence IOT platforms objects words or databases so think of you know some of the things you can do if you connect up with like I'm right now so the watts of the api's or maybe the Alexa API is from Amazon I'm using those in conjunction with your application most of the several solutions provided by the various software writers really want to make that connection very seamlessly they're really incentivized for you to go off and use their other services right so if you're using their own platform they want to make it super easy for you to connect up with their various services so I think as you're looking at you know maybe moving some workloads server to server let's definitely look into what integration so provided see what other services even easily and seamlessly connect up to and we have to do so ultimately all of these promises are trying to achieve this overarching goal of decreasing to market and that all attempting to help developers focus not just business value and their value to the users and not on infrastructure configuration I really like this quote from server less calm it says service abstracts away the most menial parts of building vacation leaving developers free to actually spend their days coding so I think that's kind of the dream of service that people are hoping to realize so there's a few views he says there emerging is really a nice fit for the server life space first one is about with you should backends so you have a front-end and it's making some calls to some backup api's each of those endpoints through ap ice can be functions that are created in a service offer a mobile backends super similar to the web application use case except the front-end is mobile Internet of Things so joseph Leo's a lot of the service platforms can help me connect up with some of some kind of IOT platform on the providers top scheduled tasks so let's say you maybe have some code that you want to run once a week or maybe once a month you can set up a chronological trigger after that code to be spun up to I mean is Wednesday's to run and then after it finishes the spins back down they are no longer being charged for those resources that are being used so you don't have to have the server up all week just to do that just to run that code once conversational scenarios so this is things like chat clients where you maybe want to do some additional processing on the chats that are coming through slowly maybe translating the text or filtering out bad words or doing some other photo processing on that text and then finally data processing so this is literally anything where you get that new item in your datastore and you want to react to that with some kind processing so this can be things like normalizing audio inputs image resizing address verification anything like that so today I wanted to quickly check out a real life use case on a mobile backend architecture so you can kind of start to get an idea for how you might not protect your server list apps so that what you're going to talk about is called weather guys this is kind of cool creative way for people to interact with the weather and it's like $2.99 on the App Store and they have they have this kind of creative way to enter after the weather so the weather just represented as various gods so there's like a fire God for heat there's an ice god for winter weather water rocks for rain and precipitation etc I think there's like six gods maybe I can't keep up with them all the users think like through the various weather events or they can subscribe to our specific notifications so I actually used to look here in Austin so when I was living here I think it's pretty unlikely that I would subscribe to notifications for high UV since I was basically quality' it was always high here but downtown where I lived there would sometimes be flooding issues or sometimes there would be hail here so I probably go ahead and describe to like water God notification interface notifications that's kind of how that works this is the architecture for how they did their back end obviously they have a mobile front-end that interacts with this back-end which isn't picture so actually this is a robbery so each of the little green functions are the functions that they created it I mean I'll kind of quickly walk you guys through that and then we'll take a step back to talk about why they chose surfer listen so the first thing that happens is that this chronological trigger it's going to query a subset of their users which are stored and I can see on TV and then the group scanner option is image determined the locations and weather conditions that those particular users are interested in then the next action is is just the weather checker and that makes a call out to the Weather Channel data service parses that purses and handles the data that it gets back gets it into the right format for their next action and goes and writes that into the weather database and then as weather gets updated into the database that will trigger a scanner for each user that's interested in that particular type of data so let's say a user is interested in snow in New York and Riaan in Austin only those two scanners are invoked for that particular user the scanners are run in parallel so that gives them some performance benefits and then of course they're also able to scale and back down independently and then once the skimmer finds interesting data for the user it'll send a notification by using the push notification service so what about this architecture makes it a really nice fit for service there's a few different points integrated platform services so they were able to really easily consume some services from their cloud platform in this case a notification service a database tons of service and the weather company needing an API so those are all pieces that are out there they don't have so great they're just consuming some services they were also able to regularly schedule their code to run every option to a trigger every three minutes a bunch of their code was running in reaction to events so they want to run in the weather trucks wanting a user location is updated they want to react to new users in their database and of course whenever there is a new weather item of interest they want to react to that as well and then finally I have the really nice scanner section where the code could be executed in parallel and independently so the turn of every users are only interested in rain and then that range scanner code can be scaled up independently of other events alternatively like let's say no one's interested in a particular weather event that codes not being called on as ultimately they're not being charged for it so finding those elements of your application where you can really benefit from running in parallel and scaling out independently can make a good use case for server list for that particular piece and then the last thing I wanted to highlight about weather gods in particular is they didn't actually start out as a fully serverless back-end like this they already had their problem than they realized okay sir so this would actually benefit from being run on a surrealist platform and so they kind of transition those elements or piece by piece as it made sense for them so let's say you're ready to write your next service up how do you get started so you have some options there's these are some of the major players in this space and listed them in alphabetical order so the person is as you're functions from Microsoft they have a Python runtime but it's currently in preview so it hasn't fully become general availability yet but I would assume that because it's a preview they were heading in that direction lambda from Amazon support spec I'm out of the box Apache open list so this is an open source Apache Incubator project and this would be really nice maybe if you eat something open-source or you want to host and manage your phone and sense of a surrealist platform for the rest of your company idea plot functions is based on open lists and it's basically just managing open managed and hosted open whisk on a VM cloud and it also supports my gun out of the box and this is the one that Walczyk and finally I know a little less about it but I think it'll be interesting to check out Python anywhere so I did a few minutes just not checking it out and playing with it it seems like it's a little more focused on web hosting and education use cases but I think it's just kind of a good one related checkout [Music] so let's take a quick peek at what a function might look like you can see a really simple example up here it should look familiar it looks like Python code so it's a straightforward hello world function and it's just going to check and see if they got mean constant as a parameter it's not it will return hello stranger otherwise it's gonna return hello with the name that was passed in so for openness and I gave top functions the expected input and output is JSON so you can tie your various functions together with JSON so let's say you have three functions and a sequence the first one outputs some JSON that would be then input for the next one that'll opposite a sound which will be that good for the next one so that's how you kind of tie them together and then the expected entry point is just a function name so you can have other functions defined at the file but main is the expected entry point so we'll see kind of a quick live demo of this in action like I said I'll be using IBM top functions which is managed openness even really take these and apply it to any circle as bottom you want so it should like look and feel very similar to a lot of the other service platforms so for our example we'll say we have this image really cute cut the image and we'll say that it's getting uploaded to our cloud object storage or database from a mobile app or UI and we want to react to this upload right running some code so in our case maybe we'll want to use some image analysis so what's actually in the image so if we upload this really cute puppy picture we want to see some output like bernese mountain dog or dog or animal so this is an architectural diagram for how we might create something like this when there's a new image URL that's upload it into the database that should trigger an action to get run in this piece I divided that action into two separate functions so one function is responsible for reading the changes that occur to the database that's the rate changes from DB action and then that action will parse the changes output the URL to a new image in the database and then he and I you're off you're off to get tax action so then they get x action will actually make a call out to a visual recognition service do some personal return value and hopefully output what it believes is in our image this is a really simple use case but you could definitely continue building on that's right you could save tags back into the database you could add an action for compressing a really large advantage of these are up with something to arch you could do things like handling video uploads by creating another function that breaks apart the video into multiple frames and then running they get tags on each frame and that would be able to scale up kind of independently each align functions get scaling out of the box so I don't have to do anything special so let's check this out this is going to be a wide so painters crossed so this is just our get tags actions that I talked about earlier should look super familiar just some Python code that we have and I'm gonna kind of walk through a couple pieces of it so the first thing that's happening is we're gonna pull in this visual recognition SDK so what that should imply to you is is that visual recognition SDKs is provided as a part of the runtime so it's just already there in the runtime and now we're gonna do a couple of things I need to instantiate that with an API key and a version of her the API key will actually pull in from parameters for this action so we should be able to pass in parameter Center options in this particular case that API key doesn't change so I can actually store it as a store parameter for this particular action so if we click on parameters you see okay I've got this API key that's stored in here and it'll just be safe for that action now make sure ever though is that right after this and then the next thing is that we'll want to pass in an image URL so that's the image that we want to get the transporter and then finally we'll make a call out to that visual recognition classify right here and then we'll just do a little bit of Percy they returned me that cuz accent and throw in there that we don't care about and then we'll run all the charts oh let's try that out this is our little puppy picture it's cute and if we do change input we can go in here and make sure we have the image in there and it is so you can click up like so we're passing this in as a friend and then if we click into though we should hopefully see yes so we see some tags back so it says puppy dog Labrador Retriever dog treat their dog golden retriever dog so just some different tags of the visual recognition service things isn't that image but that's not all we want to do we actually said we wanted to react to the image when there's a new image store the database right so let's see how we set that up this is inside of a sequence and that sequence contains two actions so there's no read from database action and then there's they get tags action and so this sequence gets kicked off by a trigger so if we go got connected triggers we see okay there's this cloud image trigger so any time a new item gets added to the comic database then not sugar will be fired so let's try that out really quick so I'll grab this image and then I already I'll pop it open I won't see a login so you can see I already have in a database created for my image URLs I can create a new document in here so just go to that create image URL I'm trying to fly it's about five minutes left me and then I'll just click create document and then what that's going to do hopefully is cause my trigger to fire which will then kick off that sequence the first action was to read from the Conde Vitesse whatever changes happen and then the second action was to get the tax so if we go over here hopefully we should see that it was caught yeah and so at eleven o'clock we can see it's there but we can see that the trigger was fired at eleven there was a sequence that was called and then the read option and then they get tax action and each action has an activation ID associated with it so we click that activation ID we should be able to see the results and there so we have the logs just the printing out and then of course the various tags that's just a little bit actually I worked at live demo always get nervous don't let me stop mirror okay perfect so I don't too much time left but I didn't want to quickly highlight I wanted to highlight one of the fight line specific libraries that's out there I'm Scott Pyron so what it does now is this goal of making a really easy push to fob experience for Python developers so maybe if you have like a super parallel workload and a parallel workload is something where you have little or no effort that's needed to kind of separate the problem into these number of parallel tasks so common examples might be like 3d video rendering hit up a GPU where you want to run some code for each frame or maybe for each pixel if you're doing the rate tracing and those can all be handled without any interdependency between them so pi renesis library where you can take your Python workloads scale it out into multiple functions to be run on a service platform so really their goal like I said is to simplify that push the cloud experience and you can run your algorithm against the cluster of machines without meaning to figure out like how do I set that up or how do I have those machines to talk to each other how do I get the results back hiren was if it's originally go for Amazon lambda and it's also available for item talk function so go check out this article to learn a little bit or talks about using Chiron for scenarios where you have a lot of data processing to do and the two examples they talked about were really large data sets like solar flares which can help protect storms making hamburger our satellite operations and then they also talked about just the sheer volume of data when looking at like how neurons combining to create behaviors or disease or cognition and there are no big goal is to really easily give access to parallel computing to data scientists and others from there's another article you can check out like I said it's built for Amazon Liotta and has recently been ported to IBM top functions so this article is about using Chiron for running stock market predictions through the money Carlo method so it uses Chiron to scale out and then combine the results from those simultaneously with predictions so that's all I had just a couple of quick notes you can go to checkout I can pop up the first link and then the last link is for the Apache openness project so if you're looking for a new open source project to be a contributor on it's a really fun one the community is really nice so that's all you [Applause]