#321: Understanding the AWS Serverless Application Model (SAM)
This is episode three hundred twenty one of the A._W._S.. PODCAST released on July Fourteenth Twenty Nineteen podcast confirmed welcome to the official A._W._S.. podcast Lebron welcome back Eddie was put cast some leash with you great to have you back on join in-person by Jaradah established who is a solutions octave here at A._W._S.. Welcome Giralda Yellow Simon Great to be here good too heavy. You're originally <hes> Venezuelan bone. I believe Ah yes the born in Venezuela and moved to Australia so been living here for the last ten years of incident not here melting with you can't have everything I guess but at least you here in Australia so you've come on the show today to help us dive deep into Sam Yeah One of my best friends you might same so sam or the civil supplication model is something very relevant to serve us. We're not gonNA dive into the concept of civilisation tip decide that a lot of people doing civilised application Asian development certainly so same customers here in Australia building backhands for Mobile Applications Building Chat Bots web applications that a processing. I've it's if it's real time or batch is as you can do everything with several so having services services one thing but having a good developer experiences a completely different thing agreed and that's really what the Civil Supplication Model Sam was credible so tell us what what e- Sam so it Rodley like you said several architectures or buildings architecture and set complete new pardon a couple years old and builders normally need the right tool so that these new parlance become easier for mental ease and the right tools than they can significantly increase speed at which they can deliver the software but also the quality of the software so Sam Sir is one of those tools one of my favorites what it does is it makes it easy to create mention of date a civilized applications and Arkansas yeah so it's an open source framework in what he does is basically allows you to define infrastructures code finding those service components mornings with a lot less code what you normally would use so this feels a lot lot clad formation so how does he's feeding with that will so the background confirmation as we know that mental deponent's that are bad right because they are in they could be inconsistent and prone to errors. I and builders have been defining infrastructure with tools like Elvis confirmation and I particularly love cloud formation. There's so many things you can do with it but when it comes to creating service applications once you start using hundreds or thousands of lambda functions interacting with your A._p._i.'s you need something that kind of abstract the you know all the complexity around set in these things and this is exactly where some comes in so sam you can think of it as a higher level abstraction to cloud formation that still using confirmation background so you still creating dating resources using cloud formation but with Sam you create the Syntax that you ride is very simplified which means less code you need to run faster development creation and overall happier develops as a developer you might choose to only interact at the Sam Lia- arrive and doing clad for my correct Sam supports everything the clever mission does so you can combine in the same time plate resources retaining Samson tax or in cloud formation syntax and the structures assigned so you have just like a confirmation template. You have a heather you have parameters you have mapping conditions resources outputs. Sam Supports Global Promises Intrinsic Functions so there's a lot of things you can tell if I'm building a civil supplication typically. I'm crying some sort of in point talking to store state of Anthem Donald Debate Etcetera Decem. Let me steetch all that together that is how should they think man absolute so with Sam at the moment there are fought type of resources that you can define you have functions for Italy Islam from the functions nations. You Have A._p._I.. And this is for Amazon A._P._I.. Gateway we do not have yet support for Elvis APP sink but this one of the most requested features for some for state like you said Dynamo D._B.. So you can create simple titles with Dynamo debate and we recently on the back of the announcements with <unk> reinvent last year we announced support for lamb the layers and we define applications using sign and this is on the back of the announcement of the several is application repository and so if I recall the tree that's that's really apply set people can share the code in a way that can be used by others or uses a bicycle crates community ran which people can really absolutely so it's a service that helps these cover deployed and published service obligations and you can do that publicly if you want. If you feel like sharing with the world or you can do the privately and assign I am policies to filter who can access that within your organization so all it is the several petition modal or SAR just to get another acronym is a managed repository for several complications that enables teams organizations and individual developers. There's two store in share. The several applications easily very easily so it's kind of a pep is built solution for if I mean the lodge organization lots of develop as immoral building `services is a place we can go. Just how has someone built this before correct so you can start using code but instead of trading everything from scratch which is what we do as developers will the time right. We don't want to be creating everything someone else did before exactly exactly and quote unquote being lazy developer is a good developer. I think I agree so something else that developers love ease command lining device. Tell us about the SAM's A._M.. Saline yes so there's more to send an justice simplify syntax to Sam comes with a Cli as well and what it does is basically brings. The power of Sam and it'll be slammed at your local machine so lambda normally runs in the cloud runs on edged locations was well. If you want to do some local development if you want to have the experience of local development where you can test test things in your in your own issues in a an idea in your in your Shane then some local bringing all of that close to your machine the where you can do there is local local testing in the book enough services application so it's a way to summarize he's about giving developers same experience they had in the world before several lists where they could alter test and the buck in local machine so this is the classic. I don't have connectivity for the Internet on the airplane. Applying Larry Plants have Internet but I don't need that identity to upload to the clad do some testing bring it down etcetera. I'm doing it all luckily correct so if you think of the developer experience you're putting some code together and you WanNa test it if you did it without Sam Sam Seila you. You have to load that to A._W._S.. Lambda make a change in lambda in the tax. I DuNNo ten twenty thirty seconds and that's not just not good enough for developers. We want immediate feedback on our applications and that's what you get with this guy you get lambda on your uncle machine so from running Nkana that off London that local mode is probably the correct by decide. What what can I do in terms of some of the connective services so obviously we use a lot of things like kanesa streams and is three et cetera not runny nose? Luckily Nah not yet not yet hopefully soon but <hes> so look there are many things you can do with some Cli locally first off you can invoke the London functions locally meaning that you can get responses and the land the logs as well in your local machine without having an internet connectivity that helps you not only get you know tested but also troubled should if there's any issues because you get the same looks that you would have gotten in cod watch as well in terms of all of those resources you ask me full you can create muck events for those so things like Amazon S. three or Amazon the I gave away or Amazon's Kabibi streams or A._C._T.'s well you can mock those and create the source events as you can trigger your alarm that using something as if it comes from the cloud but it doesn't to basically see me lighting those those interactions in a repeatable vices correct correct it generates a pilot. It's a Jason Payload that you can just send to the Lambda Lambda invocation your local mission so then you Ima- saw clumps of doing my work. Luckily I'm a mocking Adam testing at some point. If I'm following good day practices on integrating someway Eh had a Sam work in that context so there's a few things that Sam can help you do and for in terms of deployment and building and these things do you do need Internet access for them so <hes> so you can you can do some build and what doc is basically it bills dependencies for your cone so for things like if you're running hyphen review running G._S.. It looks at the dependencies and installs neural machine to frequent commands that I use our Sam package and Sam deploy so the first one six everything up everything about your application. The template end the land the code blowed starts to as three and then with the SAM deployed it executes that change in cloud formations to either create or that your obligations with two commands you're updating your entire entire obligation and also they've been the code of those it'll Vietnam the functions and so that helps you really have that whole into in process it also made you can look in things logging cetera correct so you can look into logs. You can other things you can. You can initialized several publication so if you go Sam in it can choose a the language using sipe Hyphen two point seven and it creates. I kind of blank skeleton getting started. He's the framework away correct and you can use will use salmon it for applications that have been publishing the service application repository so he basically gets you started in your local machine. If you've starting from scratch so we spoke before <unk> Linda also running at the age Henna Sam feeding to that world correct for those that are not familiar with the concept of edged computing <unk> this cloud today is pence sixty six availability zones within twenty one geographic regions but we also have this concept of edge locations and we have over one hundred seventy of those around the world in what we do this edge locations basically because we have so many more of them and they're closer to the users of the applications we leverage that for services like Amazon cloud front and route fifty three so we can deliver those responses closer to or faster to those users but. It turns out that we also launched. I service called Lambda at this was about two years ago. Don't quote me on that. I'm going on record Jeez. It is a feature on Amazon Cloud Front that allows you to run code closer to the user so basically you're running at the edge without even heaton the lowest region as an interesting this market sure about this topic is yes so that Sydney summit this year I hosted Macquarie Bank in the explain this as an Australian very popular and they basically showed how they're using what how they ask securing access to websites largely at the etch a fantastic fantastic you guys because they're doing all of these at the edge there only a couple of things that are running in the alias a region we should probably share that will get a link at their and keep it on that series as well which is a really good series now touched on deployment. I'M GONNA come back to deployment because it's kind of the beginning Chilanga he said if you WanNa deploy often and safely there are a lot of well-established Bush techniques around how to do that. Canary deploys is blue-green deployments etc but often tooling doesn't reflect that and so it's hard to deploy one of the things that Sam has I think really helped develop as with east building that he doesn't nineteenth capability so talk through what we can do correct Sam can help with that too so apart from a packaging deployed commands that I talked about previous lately the problem with that as that it's very simple just to command but what is doing is basically a one big switch so you had a previous version of the code after you execute patch diplo. You have a new version of the that's it can have an impact a significant early finally got bugs in your coat and suddenly declared you in Iraq never has bogs others on exactly so stuff can go wrong. Tom Look like like you said. The concepts of things like blue-green deployments or Canary deployments have been around for a while and this has been well established as practices in reducing the risk of for software development so Sam can help with that so let me give you some context on how these old capable about a year and a half ago released this concept of end Italy slander at Eleusis in what it is is basically a way to point to your two different versions of your lamb the function using attack and when you couple that with the stage variables Lsu A._p._i.. Gateway than it allows you to give you a flexible mechanism to basically move that Elliot's around among your lambda function versions on the back of that announcement Wilson now another feature cold traffic shifted and what traffic alas customers summers to do is basically updating additional versions of lander in whites so now you assign whites two different eleusis alumni function and now the invocation traffic that comes it will be route two new function versions based on the white white specify the easiest way to look this is your you WanNa test a new version of your land the coat you put it on a on a Beta or another development or a I don't know A._B.. Testing kind of Elliott's and then you only point five percent of the traffic and you can start start getting some feedback on whether whether that code is executing properly and slowly you can roll out his new version if everything goes well so the concept of of a Canary Deploy just to make sure actually might not have hit of that before you do a small percentage of the deployment and any monitoring so you're saying did not change anything to perform worse and marketing errors etc and you're only affecting a small percentage of the fleet and with Sammy can define a how much percent you've gone for and how long you'll whiting hell. How long is it till it's good? Do I want to run for five minutes. Thirty minutes sort of I need to be sure that I know that it's good for keeps enrolling at we can just roll Strap Saha every ten minutes expand the pool top thing correct so look with lambda. You can define of these parameters yourself now. Now customers have yellow assists in the trust subtropics shifting functionality sometimes customer ones. They want something simple. They don't want to get into the weeds of customizing all these pipelines and we also launched about a year ago a turnkey implementation of this functionality the help of A._W._S. Code Deploy in what is doing is basically traffic shifted deployments can be declared in the some templates now with a couple of lines of code in the sometime played code deploy will manage the function rollout as part of confirmation stock update. There are a couple of alarms that you can configure to trigger a rollback if something goes wrong because this is a turnkey solution you don't have all the flavors and all the options available but you have handful once you have canary you can deploy a percentage of traffic to the Canary for a given amount of time and provided that you're not triggering the cowboys charm and it's GonNa go is going basically increase the traffic by ten percent and then we have other types of linear deployments. You got about ten different deployment preference and the other thing to consider as well if you don't want to do the canary purchase that blue-green approach. Begin to just to clarify towns blue-green. We have an existing setup you deploy completely knit use it up the switch across to maintaining. That's the grain one maintaining the blue one and if you need to switch back 'cause stuff went bed you just flick back to the blue once they haven't kind of destroyed over recent anything anything in the past or begin. Sam Can can do that correct correct. You have some pretty fine options all if you don't WANNA use the SAM option that you can obviously tweak these eleusis and traffic shifting parameters to yourself yeah so you have lots of flexibility bet vision in a nice tops of stuff so you mentioned Combat Salmon Sam Cli Open source so hacking people contribute correct so look this stu tools are becoming increasingly popular but we're also accepting pool requests so those that are fitting collaborative. Please go to the Italy's lab organization GETUP hub. We're going to be sharing those reports on the notes of this book says well and what about getting started officer ICAN sort of jump into gate happen and guard that that repoened Stott doing stuff but what's a good way to start a farm may be familiar with servicemen new to this particular weived live two point. Oh Alonzo would you didn't ask I so if you're not familiar with syphilis we have Italy is the training. That's actually a website. It'll be as training is not a DOT COM website end. It has over. I think it's over hundreds of digital training courses just available some of which are related to civilization Italy has lambda. If you're familiar with civilize in a website you can find towards for building several is applications on the to get hub repos for Salmon Decem Cli. You can find examples that you can just pool in star playing with him. You can also use this <unk> repository. A lot of our customers and Soham owners have also shared Co.. There's you can get get started. Try it out. Deployed tweeted utilised blog is always a good source of good information so <music> significant number of of plus written about Salmon Decem seal and look. I think the best way of learning is just doing it so just go find some code and deployed and you'll see how we see Sam Sam Cli make up several application development or builders and something we didn't mention these which languages you can use Sam with like other limitations that we should be considering at look. Italy's lambda today supports more than a handful of of languages you have hyphen no power Sheild Ruby C. Sharp airport in promising guys in there as well as is. We have a a an A._p._i.. Iran time as well so now in Lambda you can import. You're on your own time with Sam. We have a subset of those of the Molin moment but most of those so we have the native support for iphone no no jess C. Sharp and go. I think Jarver's well John mentioned it and I'm and Sam as a bit of a character actually so does he squirrels sticker Sierra wants to do with that is for some reason he he's. He's one of the the only it'll be a service. That has a mascot. The story behind it. I think is a bit right. I think there's myths but what I've been told is that Sam left behind a cozy loving the trees to help address builders to build severance applications effectively and more easily with that cute little. It's a little mascot and if he can grab a stick around the place drought. I'm noticing your laptop on disk. Units is decidedly devoid of any stickers. Oh yes I've done if you have any develop a craig. I'm sorry I have. I have a strong opinion on that. Oh aw you're you're. You're a nudist when it comes to Lepto. There's two camps definitely as you can see from our laptop which camp off any other closing thoughts things I am very passionate about civilised and I've seen her customers <unk> that have been breasted have become faster their ability to push coz faster has increased significantly the quality of the software offs well the developer not only productivity would have oral happiness and he's victim developer has used several days before you know that you know there's there's no way back I think several this is a game changer for developers you get more developments speed you get quality by focusing more on the business that are in the business function that you're coating full as opposed to think about servers rivers and all these menial tasks that we used to care for the last couple of decades so I'll encourage every bill. They're out there to join the civilised revolution it it definitely is a bit away at it and hastened to it because I know people get a little frustrated 'cause like well. It's not magic. Doesn't your wife you magic ones in Lafayette perfectly beautiful night. It's still still work to be done an ages to knock often frustrations along the way <hes> but I would agree eighties swayze and certainly went on. I'm picking up a project doing something I always start with civilised I and arly safe. I can't do it that way will do it some other way because it's so much quicker and there's a lot of things you don't have to think about but it's interesting as the new generation develop as coming through notice they don't have a perspective on what it used to be loch ness and like manuals clad at <hes> had.