Introduction to AWS Lambda & Serverless Applications

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey good morning everyone thanks for joining us here again today at the loft here in San Francisco I've got a full day here talking about serverless content quite a lot of topics that we're gonna cover for the whole day and so thank you again here for joining us my name is Chris months I am currently principal and lead developer advocate for serviced at AWS mastery based out of our New York City office so came a way out here today to spend some time with you I've been here at AWS for a little over six and a half years across a couple different roles including representing our DevOps space for a little while and being such an architect and then before that actually worked for a number startups in New York City area companies like Etsy and meetup primarily on the infrastructure what you might call DevOps or s or a type of a role so why are we here today so all this week here at the loft we are doing a recap on things that happened at AWS reinvent 2018 for those of you who have never been to before reinvent is our yearly user and developer conference that we run in Las Vegas and one of the hottest topics that we had this year again was this concept of service and so throughout today we're gonna cover a number of different topics in this space kind of going across from kind of beginning stuff all the way up through a number of the services that play into this space so service what does this mean so it's kind of an industry buzzword these days it means a lot of things to a lot of different people but for us here at AWS that comes down to really kind of four key criteria for how we think about what service means so we kind of have four guiding principles that we think about that in our minds say whether or not something is or isn't service and so for us it means there being no service the provision or manage just means no physical and virtual no really like container orchestration that you would ever have to think about yourself should scale with usage so as requests come in or data comes in or events come in the platform that is service automatically scale to handle that and and do whatever it needs to do for interacting or solving for that request we have a terminal use now called pay for value sometimes we say not pay for idle or pay for just what you use and really when we talk about pay for value we're talking about this idea that if you have resources that are sitting idle that aren't being used that aren't say sitting waiting for requests that you're paying for that and our mind is wasted and so with the service that we talked about here today pretty much almost all of them you're not gonna pay anything if they're not in use I'd like to give the example of if you're in at an organization that has say an app that's used internally and you're primarily say a nine-to-five kind of shop that means all those other hours in the week you're paying for that infrastructure you might be not be using but in the world of service that's not something that happens the lastly availability and fault tolerance built-in so here at AWS we have a concept of regions there's over 18 of those I believe today globally that you can run your infrastructure inside of inside of those regions our concept called availability zones you can think of availability zones as essentially different data centers that exist within this geographically bound region such that one of the most basic principles of building for fault tolerance in high availability AWS is this concept of building across availability zones now in a traditional more server full model you would be thinking about running infrastructure in those yourself and doing things like load balancing or mapping requests across them but as we see today in the service space you won't have to think about that as much with the products and the services that we're gonna be talking about now those are kind of the guiding principles that we have on our side for what we stays forever this is but when we talk to customers about what service means for them and what it's brought to them it means a number of different things the way that they see it so when customers talk to us about what they see from service they see kind of the benefits that you see listed here so greater agility they're able to move faster because they're spending less time on infrastructure they're not dealing with a lot of the overhead and setting up of various things like servers and operating systems and all of that and that aligns with things like being able to better focus on just their business need so I'm able to focus their energy on writing the code I'm building their applications on talking to their customers on iterating learning what it is that they would want to get in to their product things like increased scale so we have organizations that are doing things at a scale that they would have never been able to do in their own data centers in terms of things like data ingestion data processing being able to scale out a product say for a specific period of time right maybe you deal with something like a Super Bowl it's coming up in a couple of weeks you know you wouldn't want to run that infrastructure for that event for 24/7 for entire year but in the case of things like server lists the kind of stuff where you can have very bursty quick workloads that get dealt with greater flexibility faster time-to-market etc so really what we're going to see today is just kind of the ease of use of what it is that we're going to what's possible with these products now this first hour here our focus is gonna be around a product called AWS lambda aw slam des is a compute service it was first announced a little over four years ago and then became generally available it'll be four years in April so a product that's been around for a couple of years and now lambda sits at the intersection of a couple of different concepts and ideas first here in the industry the first is that what we've seen is as micro-services as an architectural paradigm have grown in popularity and say the last decade or so that has led to this concept of event-driven compute essentially thinking of the individual actions and flows and bits of ways that your develop that your customers interface with your product as individual kind of workflows within the greater capabilities of what it is that your products do and so we could take all of the various capabilities all the ways the interface and break it down these individual events that event model aligns with being able to think of your application code directly aligning to them and so let's kind of let this concept of functions as a service functions that align to the events that make up the greater whole of your application and then at the center of this what we have is a service functions of the service offering which is lambda and so lambda meets the for kind of crea criteria that I talked about before you don't run any servers or infrastructure yourself you're not doing any operating system patching or installing software it scales for use you pay for the value that you get out of it and it's gonna be highly available by default and so there are the the fast service it's the fast industry I should say itself has grown a last number of years there's a number of options out there in the industry there's open source options there's options from other cloud providers but as we'll see here with lambda today there's quite a lot of capabilities that it has and now we talked more about what lambda is I think sometimes people lose a little bit of all of the complexity that lambda hides from you it really takes a lot of the layers under the stack and makes it so that you don't have to deal with them and so lambda isn't just a comparison to say a virtual machine or a server that might be sitting somewhere it's a computer vez that provides things like load balancing and auto scaling and failure handling an operating system management security management utilization management lots of things that lambda is doing behind the scenes that if you were to build and do this yourself would be quite a lot of complexity quite a lot of work now I mentioned lambda was first announced a little over four years ago it was actually at reinvent 2014 so I use a conference back then and it's a pretty mature product in terms of how we think of things here at AWS so again it's been out for just about four years and in those four years we've seen a lot of things go into lambda this is something that I put together back at the end October / about early November and basically what it spells out is we had a new feature capability launched into lambda every month for the last four years so quite a lot of capabilities today lambda serves trillions of events or it has trillions of events that process through the system per month so it's at a pretty massive scale as well and that's again driven by customer workloads on the platform now lambda doesn't just sit inside of a vacuum when we talk about lambda and the context what it provides it sits inside of what is considered a service application and now a service application typically has two or three components to it it has the event source so what it is it's going to cause a triggering of that lambda function it has then the lambda function and it has potentially whatever it is that your lambda function needs to connect to a database a data store another internet-facing service technically anything that could run open on a network port you could connect to from lambda and so on the event source side we've got a little over 40 different services today that directly interact with lambda plus our own API which we'll talk about here in a little bit that you could just write code against yourself and so this is things like requests to API gateways responding to an object being put in an s3 bucket doing things like pulling messages out of a queue a number of different ways that you can interface with lambda and we'll talk and look at some of these a little more closely here today in terms of your function so the initial model that we had here at lambda is that we provide basically curated execution environments that have various different programming languages built in for you and so we first launched with no Jessa Python and add a Java and c-sharp and go and then just here back at reinvent added Ruby and then something called the runtime api and i'm going to talk about that briefly here but then later today we're gonna explore the runtime api in in much greater depth and essentially the runtime api allows you to do is at this point now bring any language that you want to to lambda so you're no longer restricted by just the languages that we were providing to you and then again in terms of what you talk to from your lambda function this is entirely up to you whatever it is that your code needs to interface with you can interface with it there's no restrictions or blockers from our side you write your code it contains your business logic it does what it has to do so let's actually hold here let's you know this is kind of abstract let's actually dive in and see what this looks like and and see what we can do here so I'm gonna hop out of presentation mode here and go to the AWS console make this a little bit bigger for everybody as for those you who have maybe never seen this before this is the AWS console we've got here you know 140 plus services basically there's quite a long list of things that you could go and and explore and play with we're gonna start here with lambda so I'm gonna go into the lambda console and I am going to create a new function as you can see I've had a number of other functions here so let's call this function hello loft SF I'm gonna make this a Python function and it needs to create a role this is basically permissioning that this function will use and we'll talk a little bit more about this here in a bit and now i'm just gonna go ahead and say create oops yeah name this takes a moment or two here for it to go and create some sample code for me okay cool so now I am looking at the configuration of this lambda function that I have it right now has just the raw function itself I can scroll down here and I can view the code for this function it's very very basic we see there's just about eight lines plus some white space and what is going to happen in here is I'm going to execute this function called lambda handler and then it's just going to return some some basic text so it's gonna say hello from lambda let's go ahead and change this to hello from the SF loft and now we could save this and now we can go and execute this so inside the console here I can click test I can create an event and I'm just going to create a blank event because I don't need to do anything with this say create and say tests cool and it tells me here the little green box is good if it was bad it would be a red box in this case it says that it spit out this this JSON structure which says hello from SF loft there's a status code for it I could see that this took point two four milliseconds that I use nineteen megabytes of memory for this and I see a bunch of information that looks like what would be log lines from lambda now what happened behind the scenes here right so I have this code it was saved I have a configured lambda function that represents this code when I clicked tests what happened was behind the scenes the lambda service went and said okay we have an event it's destined for this function that belongs to Chris's account we're going to find a compute resource that's available we're gonna pull down Chris's code on that we're going to start up the execution environment we're gonna pull in the event and then execute at all and so this was a very very basic example of all that happening but again behind the scenes all of this just happened and it just worked now I can come here and I can add an event source so let me go ahead and add an EP gateway I've got to come down and configure it and so we're gonna attach this to I happen to have an existing end point for this and we'll just use what's called the deployment stage and for security I'm just gonna say it's totally open no that's probably not what you'd want to do in a real-world scenario so I can go here and save this and what it tells me down below here now is I have an API endpoint and I can go and open that up in a new tab oops there we go miss and slash cool so now I see again the same text that I saw inside of the lambda a console and so we can go ahead here let's let's test the demo gods real quick for those of you who are following along at home as it were on twitch you can also go ahead and do this let me copy this let me open up so you know let's do word sorry one second to open up a browser come out a full screen here link document sorry one second here okay so if you have a browser in front yeah on a phone or anywhere else go ahead and hit this URL hit it with with all of your might and hopefully for those of you who are following it at home on the stream you should go ahead and be able to see this as well I'll give everyone a moment or two to do this apologies for the obscure string of characters and that Billy URL we get it'll get a thumbs-up from somebody who's been able to hit it and it's loading for them cool all right so a whole bunch in here have been able to hit it hoping a whole bunch of you here on Twitch got to hit this again you've seen my amazing web application that simply says hello from the SF loft now if I come back here to the lambda console and I can go over to a monitoring tab that we have here and I can go and say I want to see things from the last hour and it's still pulling in some of this data here for us in near-real-time but what I'm seeing here is that a whole bunch of you have gone and you know loaded this application and so I fifty or so it says here right now I know it takes a little while for the metrics to catch up either way right what have we done taking some code put it into a function created on the API gateway and put it all out in front of you in just a couple minutes didn't set up any servers didn't set up any operating systems then it set up any load balancing and configure any networking didn't do anything else except just have some code that got executed by about as big a scale as we wanted to throw at it right now and again this is kind of the idea here behind what we're looking for with things like lambda now this was an incredibly basic example we didn't talk to any databases we're not really doing any sort of calculations or anything exciting but again very very low amount of work to get this up and running so we're at a hundred and sixty nine per this time period so awesome let me go back to slides here actually what I'm first going to do a second here as I'm actually just going to delete this function okay cool so it's a little deeper into again lambda and its capabilities and what you can do with it so we saw a really brief example of all the lambda function here it's actually the same code that you see here in the green box on this slide and again this code in this green box represents the most basic basic basic basic simple lambda function that you could imagine now in a lambda function you must have something that's called the handler the handler is essentially the insertion point for execution of your function from the lambda platform and so I that is where we're gonna pass in what's called an event object the context object talked about here in a second and generally this is where your business logic is is linked out of you could call sub functions or you know other code that exists inside of your deployed for application artifacts but pretty straightforward you have to have some sort of handler that you the service then invokes now the event object you saw me really quickly create just a blank JSON structure I didn't need to pass anything in there but typically the event object contains all sorts of relevant bits of information from the invocation source so if it was from an API gateway I would have things like the path parameters headers anything else about the request body that was sent in I could find information about the client and the URI they were going to and all that kind of stuff if it was from an s3 bucket so Amazon simple storage service I would see things such as the bucket and then the object key and what type of an action it was that was taken on it and again depending on the invocation service anything could be passed in for this the context object is a little bit different this is actually something that is generated by the platform it represents information about both the invocation and the underlying infrastructure that your function is running configured for and so you can use to find out things like log information total timeout for your function and a little bits of information that you might want to interface with from inside of your code but again really kind of basic thing that you could do now I mentioned previously that we have a couple languages that are managed by the lamda service in the platform and we provide updates to that periodically in new versions and so forth but we also had some announcements a couple of weeks ago at reinvent for business expanding this so to announcements which again we're going to spend almost a full hour on here later today the lambda runtime API and then layers so the runtime api already mentioned allows you to bring pretty much any language that can run inside of linux to lambda so lambda runs on linux behind the scenes and so we've seen customers bring things like c++ and rust and PHP and cobol and c c++ all sorts of things to lambda and so you can use the runtime api and it's really simple and we will dive a little bit deeper into that here today layers is basically a little different well layers allows you to do is create a code artifact for reuse and sharing of things like application dependencies libraries that you might want to share across an organization other snippets of code even things like configuration files things like SSL Certificates there's all sorts of stuff you could put inside of a layer and share a cross and again we'll talk about that a little bit more soon but again these were two really big updates for lambda and really really awesome capabilities which again will will go really deep into later now in terms of pricing for lambda you saw something when I went through the console that talked about how many milliseconds it took for my function to execute you might have also noticed the build duration for my function so one of the I think really cool things about lambda is that it builds in hundreds of milliseconds of increment so really really fine-grained down to you know what it is that your function is doing and executing versus if you had say an instance or a container that you're billing for longer periods when we first launched lambda ec2 instances we're still build by the hour now they are build down to I believe the second it is so it's a little bit different but hundreds of milliseconds still that much more fine grained for what you're doing the second kind of factor to how lambda is priced is based on the memory consumption I'm sorry the memory that you've configured it for so inside of lambda today we support anywhere from 120 megabytes up to 3 gigabytes that can be available to your function and now this is actually a really important key part of how you think about application performance and lambda because what comes with the cranking up of the memory for the function is the amount of CPU and network throughput that is available to your function and so as you go from 128 megabytes to 256 megabytes to 512 to a gig and so forth it will proportionally linearly scale again the amount of CPU that you have available to your function and so quite often what we find is that people maybe misunderstand that it can be valuable to crank up the amount of memory for your function to get CPU so take a little quick example of that so let's say we had a true CPU based workload so in this case we're actually going to just do some some pretty hard math we're going to calculate thousand times all prime numbers that are less than oh this is here a million and so we're gonna do all that in a single function execution and then we're gonna see here that we have configured that against 120 megabytes 256 512 and then 1024 so pretty much linear stepping up through the memory configuration well we see then is the amount of time that it took for that to run and then we see the cost that it would take for each of those runs to happen and so a pretty straightforward color cord coding here red is the the worst and green is the best and so we can see that with less memory it took longer with the most memory it was the fastest we can also see that with the least amount of memory it was the cheapest but if we note here what the actual difference is then for the cost for 1024 what actually works out to is that the difference between 128 and 1024 is that we shave off over 10 seconds of execution and it only costs us 0.0001 of $1 so now you know depending on your what you're doing depending on what the the need is of your application you have to decide if you know you want to make that trade-off of 10 seconds first point a1 of $1 and again this is for very CPU based workloads now I think a lot of people sometimes misunderstand what represent cpu-based workload today one thing that's really interesting is if you talked to a lot of other aap is whether they'd be a SS API is their external API is nowadays SSL communication is actually a lot more compute intensive than it used to be a number of years ago and this is because we all use higher bitrate SSL Certificates and so the computational work and handling that equip ssin is actually logarithmically higher than it used to be for lower bit rates so these are things that you can explore and what's great is that it's so easy to turn this knob up test your functions see how it behaves and understand this difference for yourself but it's pretty much the number one basic first thing we tell all of our customers who say I feel like my lambdas not running as fast as it could is how much memory have you configured it for so talk a little bit more about some of the other aspects here of lambda so across lambda we have a number of different execution models now you can think of these as just the the different ways that we can invoke a lambda function and how it's going to respond the first is a synchronous or push based model and we saw this in the example before where we had an API gateway configured to talk to a lambda function we made a request that API and it almost immediately responded back with the results of what was executed inside of our lambda function and so that is a synchronous model we're expecting lambda to give something back upstream to the invocation source now let's take an example of where maybe we take a object let's say it's an image file and we upload that to an s3 bucket or we put a message into an Amazon SNS or simple notification service topic it's gonna go into that service that service then is going to essentially generate the invoke down to lambda which will take that message or take that object information and act upon it in this situation there's no real path back to the original client that put that message into the topic or put that object into a bucket and so what's going to happen here as lambda is going to do the work that it needs to do it's going to complete that or potentially fail or what might happen but again there's no reaction back to the client and so maybe you're building a whole model looking for a change or looking for an update or something different but in this case that is an asynchronous event all right so we're not expecting something to come back the lastly we have pull based and so this exists today for a couple our invocation services we see here Amazon DynamoDB listed and Amazon Kinesis where we have streams of data that can be made available from those services and then on the lambda side we run a polar that is constantly looking for messages in those streams and then it will pull those messages our those changes out and pass them into a lambda invocation for you we also do the same thing for Amazon sqs simple queue service that it pulls messages in batches out of the queue and puts them into lambda functions so depending on your need depending on your architecture depending on what you're building you know communication or execution off of these are basically there's three different ways that you could think about how you interface with lambda now it gets much more nuanced with this and we have an entire presentation or so on how retries and failure handling and how scale plays into all of these those are all different factors but just again understand that there are different ways of invoking lambda across the different services that we have now behind all of these is the lambda api here at AWS from pretty much day one we have been an api driven organization that builds and provides api's to our customers if you use the console or the CLI or any of the SDKs or most of the management tools pretty much all the manager tools that exist in the industry to interface with AWS at some point you're talking to an AWS api behind the scenes and so lambda is no different so if we go back to the various execution models and the services that interface with lambda today they are talking to the lambda api on your behalf so the polar invokes the lambda api api gateway invokes the lambda api sq SNS and s3 invoked the lambda api and so the lambda api exists built again built into our SDKs well documented and out there and there are many times when you actually don't need to use another invocation source you can just have your own code execute a lambda function directly and so in this case you maybe get a little bit more control maybe have to take on a little bit more of the work involved but you don't have to use one of the services that we have in front of this so that there again the lambda API now in talking about the API one thing that's really critical to lambda is every aw service is security security is a credible focus for us here at AWS we think is the most important thing that we spend our focus spend and focus our time on and so land is no different and since day one of this product it's had a very unique security kind of model and aspect to it it's kind of two main things that you have to think about there is what is it that my function can do and apologies here looks like some of my the ordering on this slide it should be a little bit cleaner than this but the bullets are a little out of line so there's what can my function do so my function code can it talk to an s3 bucket can talk to a dynamodb table I'm gonna call another AWS API on my behalf and then there's who can invoke my function is it be an API gateway is a venous three bucket is it open to the world and I'm gonna share out the information for it so that people could call it for some reason and so two different angles are how you have to think about securing and locking down your function when we talk about some of the tooling that we have here in this space in the next session that we'll cover here today we'll go a bit deeper into how we can simplify this for you but again this is the stuff that is critical from a security perspective by default lambda is very locked down so by default your function can't talk to other services by default no one can invoke your lambda function and so you have to enable those things but you also want to be you know cautious and thinking about what you are enabling and how you're configuring that and so it's a bit different than just having a port open on the internet that you protect with a firewall it's again integrated into the API layer and how we think about things here at AWS now across all the things that you can do with lambda it encompasses almost anything that you could do with compute so backing web applications for example so we see a lot of companies today that are looking at say the new wave of front-end technologies so things like react and view and angular and that whole ecosystem that exists in building whether it be a true single page application or a more complex non single page application but powering that web application with an API and with compute via lambda we also see true backends for things - whether these be internal micro-services inside of a larger architecture or things that power mobile applications or even things like IOT devices that is another place where lambda plays a role and there's a lot of devices in the world where maybe things that roll around your apartment or your home and clean it up and vacuum it some of those talk to lambda there are devices that are lights or switches or heating units and things that will talk to lambda so there's a lot of places where lambda shows up that you may not even realize it today data processing so this is one of the largest use cases to be see today here in lambda and this is everything from say near real-time streaming analytics of data through batch processing through ETL workloads and today we see this again for all sorts of different use cases there are organizations like FINRA financial regulation agency that processes half a trillion events per day in lambda things like stock trades and other events that happen in the market looking for fraudulent aspects and things that happen there are companies processing tens of thousands of things like sensor data from devices again IOT space there's also companies that are doing things like collecting beacon information from ads or click tracking and websites and so that's kind of the data processing side chat BOTS so chat BOTS we see showing up all over the place these days these are chat BOTS that could be both internally and externally facing one of my favorite internal tools that Amazon recently got a chat bot I was pretty excited about it it is behind the scenes powered by lambda and some other technologies that we have but the chat bot basically simplifies something that would have required me clicking a bunch through an interface and so again we see chat bots that are helping externally for customer support we see companies that build chat BOTS that face internally for things like this internal tool that we have at Amazon that I use that has one it could be things like finance or HR or facilities related for example Alexa so how many of you have an Alexa capable device at home quite a few of you okay pretty cool so when you ask our good friend Alexa to do something that will invoke what's called a alexis skill and then behind that Alexa skill you need some sort of compute typically to handle what's called the fulfillment of that skill action and so the Alexa team says that Lane is the best platform for hosting Alexa skills and actually it's it's really easy to get started and building it it's a lot of fun if you have any impression about children spouses or small animals you can actually have a lot of fun messing with them and saying things like so I have a two and a half year old at home and I could say you know Alexa is a time for Jack to go to bed and then Alexa could tell them it's time to go to bed and so he'll listen to the little hockey puck discs on the TV stand won't listen to dad but a little couple lines of code and you can simplify your life but either way Alexa a lot of fun building skills with lambda really easy to do and so a good kind of fun hack weekend project the lastly I to automation so IT automation is a place where a lot of our customers first dip their toes and we see this plugging into things like the various development and management tools that we have here at AWS everything from doing API analysis of like API calls to being things that react to cloud watch alarms to reacting to events that happen inside of your infrastructure then we've seen third-party companies build things like whole compliance frameworks that use lambda in an event-based model to respond to things that happen and so a lot of things that can happen here but this is again a kind of the long tail of all the things that are possible with lambda so that's lambda we're gonna move a little bit past lambda to talk about some more of the service space here now we're gonna have spent a full Albert here today talking a little bit more about API gateway Amazon API gateway is another core part of the service portfolio that we have here API gateway it did not in for Amazon API gateway did not define the API space this is API gateways have existed for a long time now but what makes the Amazon API gateway really unique is that again it fits with inside of this box of what is server lists and has a number of really interesting capabilities that it can do that are only really possible inside of a cloud environment being able to have example have things like DDoS protection built in being able to do things like throttling and usage tiers at a very large scale but also not costing you anything when you're not running it an RPP gateway which again we're going to talk about and lot of depth here later has number of ways that it can be configured it can be configured to have what are called edge endpoints which are funded by a CDN can have regional endpoints that only exist in an ad base region you have private endpoints for things like internal micro services and then what back that API could be everything from lambda2 containers to traditionally compute to pretty much any HTTP facing service on the Internet so really robust product and we're gonna spend a full hour exploring and talking about api gateway today and then just sticking on api gateway here for another moment or two we did just announce at reinvent WebSockets support for api gateway this is one of the most heavily requested features since we announced the product a little over three and a half years ago WebSockets are an interesting technology and how they're changing how people think about building near real-time dashboards and interactivity and applications and so we see customers using this for all sorts of different means but this is a pretty tricky thing to do with scale because typically what happens with WebSockets and you'll talk about this a little more later is you have to maintain state information somewhere and typically you've done that on a computer which means that if you have to maintain state doing that in something like lambda which is very much ephemeral you really can't do what's interesting about this is that API gateway in this case manages the state for you and so you could use lambda to back a WebSockets API and so you can get all the benefits basically if server lists and WebSockets which is again something that didn't exist before six weeks ago and so something that we're pretty excited about what all of us lends itself to is something that we're seeing really kind of changing the industry in a number of different ways I've worked with large enterprise companies here at AWS for again over the last six years and when we go and see large enterprises they will have hundreds of applications inside of their portfolio and many of these are really basic effectively web applications now traditionally they've been things like you know Java Enterprise applications that are traditional two or three tier apps where they've got a web tier in an app tier in a database and they run on some number of servers and maybe they're largely again a nine-to-five kind of organization or they have very light usage of certain applications but all that stuff will run on servers somewhere taking up time taking it up operational overhead we've had a number of examples of companies move over to this model of a service web application where they will have again the canoe age front-end technologies like react review or angular JavaScript frameworks etc where you can host that information in something like s3 so as 3 cubic figured as a web server could optionally put a CDN in front of that like cloud front and serve that traffic out for that if it was something external and then have all of the business logic basically being served by API gateway and lambda and so with the exception of wherever maybe your database might live all of the Restless is server lists when it's not in use you're not paying for it when you need it it can near instantaneously respond to those requests and so we are seeing enterprise organizations just shutting down tons of servers simplifying their costs greatly reducing cost companies that are talking about 50 plus percent savings on terms of the these applications and so it's really really transformative and I think we're gonna see a really huge shift over the next couple years of the maturity in this space there's an awesome organization that's local here to San Francisco a net lafay that's kind of in the lead of some of this space as well and a number of other companies but really cool exciting stuff that's going on here beyond api's again there's a number of things you can do with this just to quickly walk through some more examples so again I can have a model by where I put an object into an s3 bucket and now this object could be a photo a video a log file it could be a document from my Salesforce it could be a medical record it could be an x-ray image it could be a blob of data that came out of a device that generates some sort of unique blob of data and it goes into the s3 bucket and so s3 is meant for you know infinite internet scale storage you just throw data into it it's scales you don't need to think about it and then s3 can go and invoke lambda and so you could take that data and you can transform it transcode it resize it reshape it do ml and ìaî workloads on it all sorts of things that you could do with this and so with again the tide lambda you're not maintaining stateful computer versus behind the scenes with SNS so simple notification service this is something that we see as kind of a bridge sometimes between microservices has a number different capabilities that make it really useful for that and so messages can go into again what are called topics SNS again is meant for massive massive scale and so like the you know event buses of old as it were the messages can go in and then invoke lambda functions on your behalf sqs simple queue service same kind of thing you want to batch up some sort of workload information pull out that those that workload from that queue over some period of time and execute upon it this is also really popular in micro services context where you might have a lot of fluctuation of scale up and scale down and that's something that sqs handles really really well really heavily used internally at Amazon across the world for lots of different use cases Kinesis which I talked a little bit about before so Kinesis shows up in everything from click tracking to IOT sensor information to log data anyplace where you need to ingest a massive amount of content Kinesis can handle that and then we run a polling service pulls that data out and you can act upon that data Lex this is a technology that is a chatbot service it's also very core to Alexa itself and so when you have your chat bot or you have your Alexa skill behind the scenes when you have to do what's called fulfillment of that conversation or that action that you're taking with that BA or Alexa you can evoke a lambda function and then lastly again I'm a I'm an old system in ops guy I've spent years in data centers cutting my hands on on racks and the little nuts that you have to put in the racks and losing those and stuff like that I've also run a lot of cron jobs in my life and so cron jobs pretty basic but you have all sorts of things where cron jobs become critical and you think about how UHA your cron jobs and how you make sure that they ran that they ran well and they did all these things one of my favorite use cases for lambda is basically to replace cron and so we have a service called cloud watch events which supports something called scheduled events and with that you can invoke a lambda function at a certain time you can do fun things to this we have another service called run command surprisingly enough it allows you to run commands on server based systems and so you can use cloud watch events lambda and run command to execute effectively shell scripts and other things like that on your operating systems without having to manage those servers and think about it that way so basic workload but in these kind of things which can save you time and save you effort in and just pay for themselves over time well end today talking about one of my favorite services in this space which is a service called AWS step functions and so when we talk about lambda and we talk about this concept of event-driven computing and we talked about the decomposition of a traditional app into both micro services but then this finer granularity that lambda offers up one of the things that customers tend to do is build a lot of orchestration into their code you think about having one lambda function call another lambda function call another lambda function and now this can lead to a lot of undesired consequences due to limits of lambda purposeful limits that we have but also just things that you really don't want to do and so you know what step functions do is it basically can handle workflow management for you it could allow you to do things like have decision tree is a parallelization and retry and fail your handling and we're gonna go into a lot more depth here at the end of today talking about step functions but it's a really cool core part of the service space for us here at AWS and and something that just a couple weeks ago got a lot more capability now rounding out the platform here one thing that's really important to a lot of our customers is that quite a lot of you have workloads that have to meet certain compliance standards and regimes so you know if you're processing things like credit card transactions or monetary transactions the PCI standard is very very important to you if you were dealing with healthcare records personal identifiable information any of that kind of stuff HIPAA is a regulation that you'll spend a lot of time with if you happen to be in the public sector and you have to deal with things like FedRAMP or various other government compliance and accreditation aspects the great thing is now or the very thing for now for quite some time in the service space is that pretty much across the portfolio we have those checkbox checked so if you need to build a healthcare application you can do it completely service Li if you have to build credit card processing or financial record processing you can do that service Li and so across the portfolio you have products that we have all the ones that we've talked about today and some ones that we won't get to you can you know go and read about how we can help you solve the problems that you have with these products cool so where do you start right we showed me hopping into the console before firing up a function setting up an API gateway without security sharing it to the world via bitly link which was dangerous and dumb and not something that you want to do in the real world when it's your credit card that is attached to the AWS account thankfully I'm an Amazon employee and as long as I don't build a whole lot I I don't get in trouble but for you it might be a different story so typically you're not going to just go into the console create your whole business application in a way you go typically what you're going to do is either use the traditional tools that you might have so the IDE of your choice however you might write code whether it be a more complex IDE whether it be something like notepad whether it be something like VI as long as it's not Emacs you're okay okay a couple people got the joke : it's early in the morning that's fine but we're I like to recommend people start is with a framework and so Munir we are kind of four plus years in this space there are an awesome number of frameworks that are out there really create companies that are building tools for various reasons we have some tools as well one of the most popular ones is the surplice framework you'll see it here with kind of a red logo over on the far side of the slide here one of the first frameworks one of the most robust ones that exists out there then there's a couple others that are tied more to specific languages so claudia j/s as the name might align is javascript based tool it has specific capabilities primarily around chat BOTS and api's for example Sparta is a framework for go alright and so it really kind of awesome capabilities that they've done there to help simplify building applications and go on lambda apex architects all other good tools Zappa is a Python framework and there are a number of other ones that are out there there's also a number of companies that have built interactions with lambda so that you don't have to deal with any of these so I mentioned net liffe I before which can help with hosting single page applications they have the ability to plug into lambda companies like Twilio can plug into lambda for interfacing with things like chat bots and SMS BOTS and stuff like that on our side we're actually next the next hour here gonna talk about EWS Sam this wonderful little squirrel friend of ours my good buddy here Eric in the back of the room who is another developer advocate for service here at AWS we have a whole pile of stickers for you all of our good friend Sam which again we'll talk about here in a later so you'd leave with some some fun stickers hopefully here today and then we've got a couple other tools and frameworks a tibia chalice actually came out of the CLI and SDKs tool team here at AWS they started building these tool internally to do some stuff and then open sourced it's been really popular it's a Python framework and then eight of us amplify which is a a mix between kind of a front end and back end management tool suite a whole bunch of different capabilities can also help you manage functions so I encourage people start with one of these frameworks they're going to make your life better we'll talk about Sam here a little bit so you can see that but you know instead of just opening up a terminal window or an IDE somewhere and hacking away take a look at some of these tools the other thing that we have here which we'll talk about a little bit here later today is the service application repository this is a place where you as a developer can go and share publicly or privately inside of an organization entire service applications it's basically the highest level of reuse and sharing of you know software that you could think of it's it's almost akin to a open source free marketplace of commercial software or free software open store that you could find that fits in the service world and so you come in here and you can search and find all sorts of things from an educational standpoint it's an incredibly valuable tool you can come in and find again almost anything that you want example wise and learn from it and so with that I'm actually going to hop to a quick demo here for just that and then we will break here for the end of the session great so we go back to my console here and click on create function if I then go over to the far right here and sorry because I zoomed in the text is a little squished on this box and we go to the application at the service application repository we could see here that there are you know 36 pages or so of applications it grows every day there's all sorts of things I see Alexis skills I see micro service HTTP endpoint I see an image resizer service and so some of these will vary from you know kind of toys up through really interesting kind of full-fledged components of an infrastructure this is a fun one I found just the other day and it is a magic 8-ball service application and so if you remember those those fun toys you know magic 8-ball you shake it you ask you a question you know does Sally have a crush on me and it comes back and says you know not in your dreams so you can now basically shake your laptop and do that not quite but we'll see so what I have here is all sorts of information I could go and I can open up the github repository for this I can see the what's called Sam template which again we'll talk about here in a little bit later that was used to launch this I could find what permissions it needs what software license is attached to it if there's a readme file that's been set up but I'm just gonna go ahead and deploy this so what's happening behind the scenes is this application now is going to be deployed inside of my account with all of the resources that it needs oh ah hold on one second this is because I already have one in this region and it uses some of the same names on a second come to a different region try that again great so again what's happening here is the service application repository is taking this application that was shared by this other developer and launching it inside of my account now typically you'd want to go and explore this read about a little further take a peek at the code understand what you know is going on into this we put certain kind of safety controls in place to you know help for a certain amount of you know potentially bad actors but if you look here in the resources window we see that it's creating a bunch of different AWS resources for me it's creating a function it's creating permissions and a role to creating an API endpoint tool so it looks like we're all done so let's go here click on this function so I'm in the console for this here I see I have my function it's got a whole bunch of code it's just a Python pretty straightforward actually it's only 70s or so lines of code and it could 20 or so lines are the the responses that my magic 8-ball can give me and so let me go ahead real quick here and test this I think if I create a blank event it should be okay okay test call so again tested it in the console it's firing up behind the scenes so you can see here this spit out a response and it's a bunch of HTML so that's cool so let's come down here now and actually find the API gateway endpoint so I click on the trigger I get the endpoint and I can go and open this up in a new tab okay all right so let's see magic 8-ball is everyone in this room excited about today's presentation most likely good great Thank You magic 8-ball that could have gone a really different way and so I'm pretty happy about that so you know again we can come here and and poke the demo guides and you know I can copy this link to dress we can go over here to our good friend Billy and copy that's do that's so once again here if you got a browser open in front yeah feel free to give it well feel free to give this a test never send a bitly link to a text-to-speech app it doesn't work out too well as you can see from the way this link looks so kind of a fun thing to do to generate random noise though cool so I see some magic 8-balls loading up here on people's screens and again right so we have here a a bit more of a full-fledged application than the original thing that I had that just spit out hello from the loft in this case you can actually from lamda return you know this case you're seeing HTML content some CSS and stuff and I you know kind of get this little UI and interface and this is happening just inside of my API gateway that's returning this so again various capabilities of API gateway being shown off behind the scenes but didn't set up any servers didn't sell any operating systems didn't run any software locally I'm not thinking about you know patching for this I'm not thinking about networking all of you have been able to hit it I haven't had to scale it or think about anything like that again that's kind of the beauty and the power of surplice cool so I again we got a full day of of content and talking points around this this is just kind of the early introduction to lambda into what service applications are I again we're gonna be talking a lot more in depth today next about some of our tooling and then the session after that will be around layers and the runtime api and the afternoon we're gonna have a really a deep dive into api gateway and then finishing up with step functions so hopefully here by the end of the day you've got a really good view into what sort of list is how it works for those of you who are here following on the twitch stream appreciate your participation in this we're gonna try to address some of the questions that we can hear touring to break as well and hopefully you stick around here for the rest day with us as well a lot of what I talked about here today can be found off of the service landing page that we have so AWS to amazon.com server lists this is the the home page for all sorts of content you can see kind of at the the white bar that's towards the top of the screen there a link to the service application repository a link to our developer tools section which Croods links to some of those third-party frameworks I mentioned links to resources so these are things like Tech Talks webinars blog posts white papers case studies reference architecture is getting started guides so many different things links to AWS partners these are both companies that provide technology to face our build with service as well as organizations that could come and help your company build something service if you have to drop off here again my name's Chris Mons I am principal developer advocate for service here at AWS based out of New York City I could find me at Mons at amazon.com or at Chrisman's on Twitter feel free to come and interface me on either of those to you and I'm happy to help you with that again we here the law fair gonna take a couple minute break between sessions but happy to handle questions we'll be keeping on top of the questions here in twitch today as well and so thank you and we'll see you in just a couple minutes
Info
Channel: Amazon Web Services
Views: 202,456
Rating: undefined out of 5
Keywords: AWS, Amazon Web Services, Cloud, cloud computing, AWS Cloud
Id: EBSdyoO3goc
Channel Id: undefined
Length: 56min 2sec (3362 seconds)
Published: Thu Jan 31 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.