We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Microservices and Serverless in Python projects

00:00

Formal Metadata

Title
Microservices and Serverless in Python projects
Title of Series
Number of Parts
132
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Monoliths, microservices and now Serverless. Function as a Service (FaaS) platforms give us new ways to attack old problems. The possibility of executing functions as a service allows designing scalable and highly parallel applications, but on the other hand, this kind of applications require a particular programming style. For example, bundling dependencies and managing state is not trivial. However, there are plenty of tools and frameworks to help you code serverless applications with Python, and once you get started it is not complicated. In this talk we will mention the advantages of Serverless and we will focus on the situations in which we can introduce it into our Python projects. We will use AWS Lambda for the examples. These could be the main talking points: Introducing Serverless and Function as a Service (FaaS) in Python projects Advantages of Microservices and Serverless AWS Lambda functions with chalice Testing AWS lambda with docker
Keywords
35
74
Thumbnail
11:59
Function (mathematics)Service-oriented architectureLambda calculusVideo game consoleSystem callLetterpress printingReading (process)Dependent and independent variablesDrop (liquid)Read-only memoryGateway (telecommunications)Software frameworkData storage deviceView (database)Dependent and independent variablesMetropolitan area networkWeightType theorySocial classExtreme programmingWater vaporFlock (web browser)Fault-tolerant systemLie groupBlogRAIDLine (geometry)Multiplication signFlow separationDemosceneSemiconductor memoryArithmetic meanElectronic mailing listNumberSpring (hydrology)Point (geometry)Flash memoryMassSakokuBoss CorporationShared memoryCommunications systemAddress spaceProcess (computing)Core dumpHoaxSymbol tableAreaGoodness of fitValue-added networkHypermediaCartesian coordinate systemEqualiser (mathematics)SpacetimeUniformer RaumPhase transitionLatent heatHand fanPlanningDifferent (Kate Ryan album)Coefficient of determinationOrder (biology)Roundness (object)Rule of inferenceMessage passingGame theoryPhysical systemArchitectureFunctional programmingData managementAngleScaling (geometry)Representational state transferEndliche ModelltheorieBefehlsprozessorVideo game consoleResponse time (technology)EvoluteRelational databaseObservational studyoutputProjective planeTerm (mathematics)Thread (computing)Task (computing)TwitterService-oriented architectureConcurrency (computer science)Uniqueness quantificationFunctional programmingBoiling pointFluxCombinational logicBlock (periodic table)Web 2.0Game controllerComputer configurationOperator (mathematics)TelecommunicationKey (cryptography)Parallel portSystem callServer (computing)
Message passingCodeInterprozesskommunikationRouter (computing)PlastikkarteSource codeArchitectureOpen sourceServer (computing)Client (computing)Flow separationService-oriented architectureComputer configurationScaling (geometry)Point cloudFunction (mathematics)Process (computing)Online chatComputer fileEvent horizonTask (computing)Structural loadSoftware testingContext awarenessBlock (periodic table)Cellular automatonPhysical systemCodeClient (computing)Socket-SchnittstelleCartesian coordinate systemBootingFunctional programmingMessage passingServer (computing)Service-oriented architectureTask (computing)CASE <Informatik>AngleFlash memoryBuildingGroup actionLie groupCombinational logicOperator (mathematics)ArchitectureoutputScheduling (computing)NeuroinformatikMereologyLogicSystem callFunction (mathematics)Process (computing)Type theoryVirtual machineMultiplication signQuicksortLatin squareInteractive televisionGoodness of fitSoftware developerOrder (biology)Endliche ModelltheorieInstance (computer science)Channel capacitySoftware testingSquare numberConnectivity (graph theory)Event horizonLine (geometry)Equaliser (mathematics)Attribute grammarForm (programming)Library (computing)Point cloudFocus (optics)Graph (mathematics)Network socketCloud computingReal-time operating systemIntegrated development environmentRepresentational state transferLambda calculusMetropolitan area networkVideo gameWhiteboardComputer programmingSocial classAreaBoss CorporationDependent and independent variablesForcing (mathematics)Extension (kinesiology)CuboidOntologyECosQueue (abstract data type)View (database)Observational studySound effectMilitary baseGreatest elementAlgebraSampling (statistics)Symbol tablePoint (geometry)Student's t-testTerm (mathematics)Price indexMathematicsSeries (mathematics)Food energyInternetworkingField (computer science)GodWater vaporHypermediaArithmetic meanElectronic mailing listModal logicRoutingComputer animation
Structural loadHaar measureServer (computing)Data managementScaling (geometry)LastteilungInternet service providerControl flowFunction (mathematics)Integrated development environmentLambda calculusSimultaneous localization and mappingCodeService-oriented architectureSoftware frameworkLambda calculusCASE <Informatik>Operator (mathematics)Functional programmingInternet service providerWorkloadFunctional programmingNeuroinformatikGene clusterProgramming languageIntegrated development environmentGoodness of fitLoginGraph (mathematics)MultiplicationLinear codeComputing platformComputer fileProcess (computing)Event horizonElasticity (physics)Multiplication signVideoconferencingMedical imagingTranscodierungMathematicsMultimediaPoint cloudProjective planeArchitectureServer (computing)Semiconductor memorySampling (statistics)Point (geometry)Dependent and independent variablesLimit (category theory)Client (computing)Cloud computingData storage deviceStructural loadOpen sourceThread (computing)Run time (program lifecycle phase)Endliche ModelltheorieImage processingThumbnailAreaMassCuboidTransport Layer SecurityContext awarenessArchaeological field surveyRight angleMoving averageFlow separationForcing (mathematics)Group actionDuality (mathematics)Axiom of choiceWater vaporPurchasingTask (computing)Reading (process)HypermediaMetric systemOperational amplifierDifferent (Kate Ryan album)ECosBoss CorporationGreen's functionObservational studyState of matterPhysical lawData miningArithmetic meanForm (programming)Game controllerWhiteboardView (database)Feasibility studySocial classSoftware developerQuicksortSelf-organizationComputer animation
Event horizon2 (number)Multiplication sign4 (number)Data storage deviceComputer configurationWorkstation <Musikinstrument>Functional programmingDependent and independent variablesFunctional programmingService-oriented architectureComputer programmingApproximationType theoryClassical physicsLambda calculusRepresentational state transferSynchronizationRow (database)Group action
Function (mathematics)Lambda calculusSystem callEvent horizonInformationRun time (program lifecycle phase)Context awarenessParameter (computer programming)Point (geometry)Configuration spaceRead-only memorySoftware frameworkGateway (telecommunications)Focus (optics)Point cloudServer (computing)Demo (music)ArchitecturePoint (geometry)Inheritance (object-oriented programming)Coma BerenicesRepetitionMultiplication signContext awarenessSymbol tableQueue (abstract data type)Quantum stateSeries (mathematics)Bit rateCartesian coordinate systemForm (programming)AreaWebsiteView (database)RoutingServer (computing)Condition numberThomas BayesTelecommunicationSoftware frameworkGoodness of fitGreatest elementKeyboard shortcutDemosceneCommutatorProcess (computing)Game controllerSemiconductor memoryParameter (computer programming)Graphics tabletEvent horizonComputer fileRun time (program lifecycle phase)Interface (computing)Point cloudVirtualizationLambda calculusFunctional programmingGateway (telecommunications)Flash memoryFunctional programmingString (computer science)Service-oriented architectureRevision controlVariety (linguistics)CodeType theoryTemplate (C++)Error messageData structureConfiguration spaceSoftware developerClient (computing)Computer hardwareProjective planeChemical equationComputer animation
Social classArithmetic meanChannel capacityCartesian coordinate systemScaling (geometry)Computer virusState of matterSystem callLine (geometry)SpeciesConfiguration spaceFlash memoryProduct (business)Functional programmingVariable (mathematics)Software developerInformation security
Run time (program lifecycle phase)Lambda calculusGateway (telecommunications)Link (knot theory)Function (mathematics)Uniform resource locatorDependent and independent variablesException handlingParameter (computer programming)Web pageGateway (telecommunications)Service-oriented architectureFunctional programmingInformationProjective planeModal logicSet (mathematics)Functional programmingFluxTable (information)RootCartesian coordinate systemComputer fileData storage deviceInstance (computer science)Mobile appSoftware frameworkMultiplication signSingle-precision floating-point formatConfiguration spaceCodeDatabaseOrder (biology)Flow separationLambda calculusProduct (business)Message passingClassical physicsObject (grammar)WeightState of matterHypermediaSpacetimeData managementFitness functionCoefficient of determinationSemiconductor memoryChannel capacityWhiteboardInformation securityBlogSystem callRational numberArithmetic meanBitCore dumpSocial classCASE <Informatik>Goodness of fitForcing (mathematics)Computer animation
Message passingComputer configurationRevision controlDirectory serviceFunction (mathematics)Lambda calculusGateway (telecommunications)Identity managementServer (computing)Time evolutionArchitecturePoint cloudService-oriented architectureTable (information)AreaSoftware testingGroup actionSubgroupNumberLattice (order)Library (computing)ArchitectureInternet service providerUniverse (mathematics)Water vaporSpeciesNeuroinformatikLogic gateMultiplication signOperator (mathematics)QuicksortOcean currentOrder (biology)Roundness (object)WhiteboardTerm (mathematics)ArmArithmetic meanLimit (category theory)Projective planeSampling (statistics)Integrated development environmentoutputTemplate (C++)Server (computing)CodeSoftware frameworkComputer configurationLocal ringFreewareMedical imagingType theoryCartesian coordinate systemMathematicsDatabaseSemiconductor memoryCalculationRepresentational state transferVirtual machineComputer animation
Transcript: English(auto-generated)
morning, thank you for coming. Uh, yes, uh, this talk, uh, is about how to introduce, uh, microservice and serverless, uh, architectures in Python projects in general. I will try to, to explain, is, is one, uh, with practical, uh, symbols, uh, and, uh, for the
side, whether, whether microservice or serverless architecture operations are well s- are well suited for your architecture or not. Uh, um, basically we start with a couple of, of definitions, what are microservice and serverless and some examples. And, and this is the main points I'm going to talk. I will make, uh, I will, first
I will talk about microservice in Python, what are the frameworks and the tools that we have in Python for, for building, uh, applications, uh, following this, this style of, of architectures. Later I will introduce, uh, basically serverless, what are
serverless, um, functions as a service, the, the main, the main, the main points of this, uh, type of architecture. Later I will comment, what are the main Python frameworks for working, for example, with, uh, Amazon, with services, uh, from, from Python. And, uh, I will center in, in two, in two, in two tools, uh, that
goes, uh, some demos, uh, floor deploying, uh, AWS alumni from Amazon console.
Well, uh, this is a graphical view from Google trends where we can see the evolution of bomb steps, basically a microservice, uh, uh, are, uh, uh, at this moment, uh, uh, uh, uh, uh, over, uh, over serverless, but the term
serverless began to be no more at the beginning on, on 2017. Um, uh, basically, uh, nowadays, uh, microservice, uh, is, uh, most, it's a more used term than serverless, but in, in the next years, maybe, uh, serverless,
uh, architecture, serverless, uh, topics, uh, will increase, uh, can, can equal input or a microservice. This is the, the, the evolution, the evolution with, uh, I think that, uh, uh, serverless, uh, in the next years, uh, uh, can, can, can equal or, or, or put over microservice,
uh, in, in, uh, in the next years. Well, when we are talking about microservice, basically, a microservice architecture, uh, puts each functionality into a separate service and a scale by distributing the service across servers.
Microservice architecture exists when your system is divided in a small responsibility blocks, uh, and those blocks doesn't know each other. They only have a common point of communication. Generally, a message key we, we can, uh, in Python for example, we can find some tools like, uh, uh, like celery, uh,
developing the, uh, them, uh, our architecture with, with microservices. Uh, in general, if you are building microservice in Python, for example, we have, uh, these two, these two frameworks, tornado and twisted. Basically, uh, these two frameworks, uh, are,
are very useful when you're, uh, have, uh, when you increase the number of concurrent requests, uh, and, uh, and it's, and it's important that the request, uh, are, uh, are calling in a synchronous model. And these two frameworks are very useful for, for this, for,
for when you have a very, uh, a lot of, uh, concurrent requests and you have, uh, uh, each request in a, in a specific, uh, process on a specific thread in a synchronous way, you can use these frameworks. Uh, with Python also,
we have a classical, uh, very, no asyncio and an HTTP for example, in microservice architectures, asynchronous calls, uh, play a fundamental role when a process, uh, used to be performed in a single application, uh, no implication server and microservice. Asynchronous calls can be as simple as separate, uh,
thread or process within a microservice by application. In this example, we are using asyncio and HTTP as the main model for, as the main models for, for doing these tasks in our application. In Python also we have, uh, uh, we can,
we can find frameworks like Flash or Django frameworks. Uh, these frameworks basically are oriented to, to developing our REST APIs and communication system based on HTTP. Would this perfect for wielding our, our microservice architecture. These two frameworks are the most known in Python ecosystem, uh,
for basically for creating web projects. Uh, in my opinion, if we have to, to select one, one of these between Django and Flux, I think that the best option is Flux maybe because, uh, is it fits perfectly with the principle of unique responsibility in
microservice architecture. Flux also allows to be a model or terrain for simple. If you want to create an AP management or working with a no relational database or other systems like, like, uh, GraphQL and now, uh, uh, now I will comment the,
this kind of architecture with GraphQL and for example, for the performance, a point of view, uh, uh, there are some studies that, uh, uh, uh, uh, say that Flux, uh, to not to consume eight percent less memory and have six percent,
uh, response time, response time faster than, than the angle. And in this task and from this performance point of view, uh, in terms of memory, CPU and response time, Flux, uh, has a better performance than, than, than the angle.
I'm from the, and we are, we are developing our architecture thinking in these kind of, of tool. We must keep in mind that when we talk about microservice is usually combined by a greater consumption of memory and resources and the performance is
important to, to, uh, uh, no, no, no, no. It's suspect study. This aspect in our application. I know that type of architecture we find in microservice is the use of GraphQL. Uh, GraphQL, uh, uh,
brings a microservice, uh, raceman such as data owners separation, granular data control, parallel execution and service coaching. Another benefit of adopting GraphQL is the fact that you can fundamentally assert a greater control over the data loading process. Uh, because the process for that goes into its own on point,
you can control in a granular way how data is transferred and will provide in this aspect, uh, uh, a good solution for, for, for doing the, the, the, this kind of, of applications.
Also, we can combine, uh, uh, the combination of a well with Python, uh, basically is designed to replace recipe API. We can boil with flash or then what is framework. We can use the combination, uh, with, with Python. What are the frameworks that we can use? For example, graph in Python is a library for, for welding.
Well, API in Python in a, in an easy way and he can integrate with applications by in the angle flash or an H equal alchemy for simple, basically graphene, uh, for simple, uh, allows you to define your, your models, define the attributes in your model.
And I saw per square is to get the data for those particular models in the same way that we have, uh, the, the angle, uh, over them. For example, we can use graphene to define our models and a schema and interact with interface, uh, where latin or, or not. I know there are type of architecture that we can build with,
with microservices. For example, is using a the combination of the angle and celery. For example, the angle can meet many tasks for, we have, uh, uh, an architecture with, we, we can use, for example,
ready or rather me Q of message broker and celery. Basically what provides is an asynchronous distributed task. Kiwi, uh, we can pass the, the message to the, to, to, to the application. It's a celery is a good solution for real time operation also,
but support scheduling as well. And as a comment, it's useful for celery is very useful for background task processing and you can communicate with the angle, uh, throw the missile broker lie and write this or rather meet you.
I know that another solution that we can use inviting is you see in the use of, oh, oh, thero, thero, me Q, Sarah, me Q provides a building blocks to develop a scalability, the tribute, the boot system on top of sockets. Uh, basically we can build for a simple, uh, simple,
probably subscribe microservice, uh, for simple, we share with make you on flash. We can, we can build in a simpler way. The, this kind of architecture, for example, this can be our server, our server make you server or bullish it. This, in this example, the response, uh, service call is police as a message.
We have a message and the message will police in the showcase that provides ceremony. I love it. Our client, eh, we'll rather the message for all from these, from the socket and for whatever, for them and the application will, will respond to the, to the,
to us a message. And this is the client, the client part where we got, this can be our ceramic click guy and also a subscriber. In this example, we have a glass set a client that we thought they need metal where the constructor, where we initialize the horse, the ball and the context.
The for, for subscribe there, the client basically the attack line is subscribe to the channel where the server is sending, sending message. And when we're, um, um, when the server send a message, the guy in response, eh, calling with a, she's, she's calling,
she's may shot and connecting to their subscriber, eh, topic. Well, eh, in general, the idea with microservice, the idea is a brick, the monolithic architecture and separate each form is relevant functionality in
a specific component. Eh, microservice also has short working stereo and improving incrementally in simple tests as a service are the, are the couple each from each order. It's very easy to upgrade and improve a service without causing the order to go down. Eh, make the service also can be much better. Eh,
maybe there's via container for samples. We are working, we are working with Docker or Kubernetes solution for simple microservice are, are, are, are maybe I am a very useful sort of solution because provides a, an effective, a complete, eh, betrayed be to operate the system beyond immense processing solution and so
on. Well, uh, now I'm in commenting the serverless part of the serverless, eh, well, I will start with our definition. This is the definition that we can find in, in Wikipedia. Basically serverless computing is the practice of building and running
service and, and applications, eh, without, without having to worry about provisioning and money management, eh, service. Basically, eh, what we are doing is the code is running in a secure environments that are managed by cloud providers such as Amazon,
Google, Microsoft, and so on. We'll serverless which you can deploy your code in the cloud without worrying about instance capacity. Basically it's automatically managed by the cloud provider in a completely transparent way by, by the developer. Well, eh,
serverless architecture, eh, basically, eh, the serverless architecture that I'm going to, to, to comment, eh, is based on function as a service. Function as a service, eh, means that every serverless model that, that you are programming,
eh, has a function. And this function is, is execute, eh, on the cloud. Eh, basically provides, eh, features like scalability, provisioning, eh, eh, eh, the deploy, eh,
all these things that you, that you normally, eh, eh, are, eh, are, eh, executing in your, in your, in your local machine. You can't use this cloud providers for doing this, for executing this command. And another feature is that, eh,
you only pay for the time your code is running in the server cloud provider. Serverless computing, eh, basically, eh, the, the, the, the best, eh, the best, eh, eh, future is that allow us to focus on building the application without
managing infrastructure. And what provides to the developer is, the developer's focus in the, in the output, the, the input of the, of the, of the Lambda function and the logic in between. And the rest of the, of the, of the French to two servers, eh, memory, CPU, the rest is,
eh, is all managed by the cloud provider. And you only need to focus in, in, in the important of application, the logical of your applications and, and the, and the inputs and the outputs. In general, serverless functions, eh, these are, eh, eh, use cases.
For example, we can build, eh, eh, REST APIs in the same way that we can, that we can find when we can build with, with flash or then what is framework. Eh, we can also use this, this kind of architecture for building chat box, eh, for evidence. Also, it depends that the evidence, it depends,
the, the group provider, for simple, eh, Amazon provides the S3 event for five processing, eh, data ingestion. Eh, also, eh, you, we can, eh, it's very useful. These, these kind of architecture for data and processing, eh,
yeah, IoT projects, eh, instead of funding, because for example, for example, eh, Amazon, for example, provides a clockwatch event log. And, eh, another type of stacks, related with cellular stacks, like monitoring, no-attentive, empirical, just this.
All these are use cases that we can, that are, we can find in, in serverless for, for, for managing the, the projects. In general, eh, LaDella will comment, eh, what are the, the, the, the, the drawbacks of, of serverless, but in general,
serverless functions, eh, are well suited to operations that take, eh, a very short time, eh, to complete. And, and, and no resource intensive because, but what, eh, eh, eh, why? Because workload providers normally impose, execute on time and memory limits, and, eh, eh, eh, with mean that if the workload
is a long-running process, a conventional server model may be more appropriate, that using the, instead of using a serverless solution, we can, eh, we, we need to, to use a conventional server because, eh, eh, our process, our, our, eh, our,
our thread or, or, or our application, eh, expects the, the time and memory limits imposed by the workload provider. This is another example that, that, that provides, for example, with Amazon, eh, this is a sample
for processing and serving multimedia with AWS architecture, this is, eh, popularized by, eh, Amazon, eh, basically is an image processing event handle function, the function, where the function, this is our function, and the function is connected to a data store such as Amazon, Amazon S3
that emits, change event, and each time a new image file is uploaded to, to a folder in, in S3, an event is generated. And forwarded to the event handle function that generates a thumbnail image that is stored in another folder.
And in, in that way, we can see that each time a client uploads a multimedia to the S3, the S3 is the data storage of Amazon, and, and each time a client, a client upload a multimedia to, to this data storage, the process is executed. If the multimedia event is a video,
the lambda, the lambda function is responsible to, to calling, for example, eh, Elastic Transcoder Service, this is the, the service that, that, that use, eh, Amazon internally for, eh, converting, eh, eh, processing video and so on. And if we have an image, then we call the,
the Amazon, the, the, the other service that, that has Amazon for, for this task. And basically all, eh, all these, all these eh, graph is a, is a work function. And depending eh, the, the events that, that produce eh, eh, it calls eh, one,
eh, one side of an, or, or another. The, the benefits that provides eh, serverless eh, solution, basically you don't have to worry about clusters, load balancing, eh, you lower eh, infrastructure costs, as I comment before, by a developer, by developing a serverless
system, the infrastructure costs, can be greatly optimized, eh, as there eh, there could not be a need for servers to be running permanently, permanently, and the server starts eh, whenever the function is triggered or a, or an event is produced. And stop, whenever the, the function
gets executed successfully. And the drawbacks, also we have eh, a little drawbacks, for example, eh, the drawbacks reacted with eh, eh, eh,
the booting, the plug-in and monitoring, eh, but well, eh, eh, eh, the, the plug-in and monitoring, for example, the, the, the behavior of multiple functions maybe eh, can be most, more complicated than monitoring and microservice, for example. In, in this, in, in this kind of,
of, of architecture. Eh, for the booting, for example, eh, we have eh, eh, a good support, in general, I, eh, there is a good support for, in most tools, eh, I want to comment eh, later, and most tools include eh, visualized logs in different
developing environments, for example, in Amazon we have CloudWatch logs for getting metrics, monitoring and the booting, eh, but well, there are many tools, but it can, it can be, it can be better in, in the future. And another drawbacks that we have is that eh, well, the tools around eh, development, automation of
serverless, eh, there are many eh, eh, developments, but eh, many, many of, many of these tools are still in development, are in futures, eh, and so on. And another drawback is eh, there is, we have no control over the, the containers eh, because eh, eh,
what, what, what are doing these eh, cloud providers, eh, when, eh, when you call, when you have a linear function in, in, in a cloud provider, internally you create a container for, for executing the, the, the code and so on. And we have, in real life, we
have no control over, over these eh, over this execution environment in, in, in the containers. Eh, eh, well, this is the eh, regarding the eh, cloud providers. Well, eh, the most, the most eh, known maybe can be Amazon,
because we have a lot of service. Eh, one of, I'm commenting, commenting now is eh, the Lambda service. Eh, also we have eh, go-cloud platform Microsoft Azure, and for open source solution we have eh, Apache, Apache on OpenVis, and Kubernetes.
Eh, Kubernetes is a serverless framework for Kubernetes. If we are going, if we work with Kubernetes we can use Kubernetes for a serverless framework for, for doing these, the, these tasks. And OpenVis is an open source eh, project for, for IBM.
It's a, eh, basically provides eh, native support for many languages, eh, and supports other language, many languages and run time via Docker containers. Eh, basically these two frameworks eh, are designed to be deployed over, for example, we are
working with Docker, we can deploy over, over Docker or Kubernetes clusters. Eh, and they offer a serverless open source environment where we can execute our code. And eh, they support many languages like Java, Python, Node, eh, PHP, and so on.
Well, eh, and at this point eh, well, I am going to centre now in, in the Lambda service in, for, for Amazon. Lambda is the main AWS eh, service dedicated to, to serverless computing. It is integrated with the rest of Amazon service, like the
IP, eh, the IP gateway, eh, then MongoDB, notification service, S3, and so on. It's a service, eh, basically it's a service that allows you to write eh, eh, Python eh, code that gets executed in response to S, to events like, eh, HTTP request
or for example when we upload to, to a file to, to, to Amazon storage, eh, we, eh, we can write our functions for responding to, to, to, to the events, eh, like, like this.
What is the eh, basically with Amazon we have eh, two types of, of course. We can eh, we can do approximations. When we are eh, programming with Amazon we have two approximations. The synchronous that implies that we have a REST API
and so the API gateway, we involve Lambda functions behind the, and we have, behind the API, we have the classical record response and the other approximation for working with eh, with Lambdas is the, the synchronous way that in, in in place, in place that
there is a Lambda function that is listening to events. For example with a file, it will, it should, it should load to a storage, eh, bucket from, eh, in Amazon or where, when we get a notification, eh, in Amazon, eh, notification service. And, and when it's produced, this, this action
then is called the Lambda function. Eh, Lambda functions are a key balance, basically are a key balance to salary workers. If we, if we know this, this, this kind of architecture, if we, if we have work, we, we salary, eh, Lambda function is the, is the key balance. The idea with Lambda function is that
they can be triggered asynchronously via some, eh, AWS events. Basically the, the benefit of, of running a Lambda function is that you don't have to, to, to deploy a salary, a salary microservice, eh, that needs to run a 24, 24, eh, 7
to be messaged from a kiwi. A Lambda function, eh, basically is a handle function that, eh, eh, Amazon can invoke when the service executes your code. Eh, eh, this is the basic syntax, the area syntax structure when creating a
handle function in byte. We have, eh, the, as parameter, the event and the context. The event, eh, eh, is the parameter for passing, eh, data to the, to the handle. Eh, the parameter, this parameter is usually, eh, a big
dictionary type. And the context is, eh, this parameter provides the runtime information, eh, to your handle function. And the return value of this function can be anything, eh, from passing values, eh, to dictionary errors converted to JSON string
for example. How we can create, eh, this function in, in Amazon, for example, eh, with eh, AWS, AWS client command, eh, eh, from, from this client, with this client we can create a lambda function. Basically we provide, eh,
eh, the region of our, of our, eh, account in Amazon. Eh, the file with our code, our role, eh, the runtime with, eh, with the Python version that we are executing. And other parameters
are added with memory and time out. And what that is and this, eh, this, eh, key padding tool, eh, we, we go to our control in Amazon. This is the interface that provides Amazon to creating a lambda function. Basically we can, eh,
deploy our lambda function, and we will add it, eh, as, eh, the file. And from the configuration point of view, the most important is, eh, obviously, specify the, the, the runtime with Python, eh, the Python version, and the
hardware function. What are the main frameworks that we have in, in Python? Well, eh, for simplify the development process of lambda functions there are some frameworks, eh, and two relays from, from developing and managing your Python serverless application.
I will focus in two main, eh, sub-analyses, but eh, there are many others, like serverless, eh, lambda file, and Python lambda. Basically, eh, when we are working, we, we learn the function is important, eh, to know the, the, the, the Amazon, the Amazon
AP Gateway. This service lets you define an API that is fully managed by the, by Amazon. And provides, eh, offers a variety of way to, to control access, eh, your APIs. This, the, for example, the serverless, eh, framework, this is
eh, a framework that eh, is built in JavaScript and requires eh, Node.js. Eh, you can install it via NPM and so on. And provides, eh, eh, eh, a boiler, boiler, boiler, boiler
boiler templates for creating our projects. Well, I'm going to start now with SAPA. The SAPA basically is a framework that in an easy way, you can deploy your Python eh, applications with eh, AWS lambda and IP gateway.
With SAPA, eh, each request is given its own virtual HTTP server and eh, it communicates with the Amazon AP Gateway for, for doing this, this, this control. Basically, it com, you can communicate, eh,
basically, it creates, eh, a virtual, eh, eh, server in, in, in, in the cloud. And it in, and it executes eh, eh, the, eh, and it creates an, an API, eh, in, in, in Amazon AP Gateway.
Basically, for working with, with SAPA, SAPA provides a command line tool for, for, for, for Lambda functions, eh, eh, and for developing, eh, for deploying, eh, for working, for example, with, with Flash and Django, eh, eh, it has a lot
of, a lot of, a lot of features. In this example, we can see that in an easy way, with SAPA init command, eh, eh, this, this tool, eh, provides an interactive wizard that helps you, that helps you to set up SAPA projects, eh, quickly when you are first getting
started. The command line, eh, tool asks you, eh, simple questions for, for example, if eh, eh, it detects if you are working with Flash or Django projects, it has the capacity to detect automatically, eh, this feature.
And the security of, of, of this command eh, asks you about the configuration eh, environments, eh, if you are working in, in in developed states or productions and other variables like eh, your main Lambda function.
And in a, I see in a simple command, you can deploy, you update or destroy an application for a specified state, that is the developed state or production. When you, once you create, eh, your, your project, eh, you manage the configuration, the configuration directly in, in the SAPA
settings file, eh, basically this is a simple JSON that stores your, your project configuration for, for each state. And it retours information about ratio execution, root time execution and application settings. Basically, when you deploy eh, SAP automatically
eh, eh, eh, eh it create, create the package eh, would load up the, the package the, the, the file to, to, to Amazon eh, storage, data storage eh, create or manage the necessary policies and roles, on, on the users
and and register all the information in the AP Gateway. This is an example where we can see that with SAPA, we create, basically we need a virtual name.
And this is the hello world from SAPA, where we got executed with a simple command, SAPA deploy and deployment, automatically package to blow up,
creating the AP Gateway routes, and deploying the AP Gateway. And you have the URL where the service is working. Also, another interesting feature that provides SAPA is that offers the possibility to execute functions
in a synchronous way. In this example, for example, you have a Flux API to make an order. You can call a function in a completely separate Lambdas instance by using the SAPA syntax decorator.
And you can set all your Lambda functions in the same way that you can configure your celery workers. This is equivalent to configure a celery worker, for example. And the last solution that we're going to comment is the Celis. Celis is a micro framework for managing the Lambda functions
on the AP Gateway. In the same way that we have seen with SAPA, Celis provides a command line tool for creating, deploying, and managing your app. The project is available in PyPy.
You can start with Pinistan and available in GitHub. Basically provides, Celis enables single page HTTP sending and you can use Python decorators, for example, the root decorator that automatically
builds a routing table for the Lambda function to invoke functions based on the request pass and method. In this example, for example, we are declaring our function with the uproot weather and pass a parameter
the city for retaining the weather. For example, we can build our recipe in a nice way with Celis, for example, if we have a classical recipe
for getting, creating, updating, or deleting objects in this case, for tall object, the code is very simple.
For example, we only need to annotate the function with the decorator root and specifically with the method in the method parameter we define. We want to get a pause, a delete, or a pause. And basically for doing this task, we can use,
for example, in this case, we are getting the torch for a database in memory, for example. And for update, we need also the ID of the tab.
In below, we can see that we passed the ID parameter for modifying the tag information. We can see that in a nice way, we can develop our recipe and deploy it automatically in this case, in us.
Celis provides many options. This is the option that provides. We can deploy our application in local host. We can create a new project.
We can generate policies. And this is basically what this does. Celis, when we made our Celis deploy, Celis internally updated random functions,
sending the change to Lambda, the API already found, and deploying in the environment. And finally, if we want to test this kind of solutions in our machine with Docker, for example,
we have a collection of containers for testing AWS Lambda environment. In particular, we have the Docker Lambda image. Basically, it's a sandbox local environment that replicates the live AWS Lambda environment
almost identically, including software, libraries, environment variables, context, objects, and behaviors. And finally, for commenting that the course that are supposed using this service,
we have the service serverless code. It's basically a cost calculator where we introduce the number of executions, the estimated execution, the memory. It will include a free type because Amazon includes a free type
for testing this kind of service. And depending what are the input of this, of memory, and so on, it will do the cost, the possible cost of using this service.
And you can compare what is the most cheaper solution for making a provision of your memory. For your project, for example.
For learning, this time of architecture, we have most examples. Amazon provides blueprints. Blueprints are samples that are configured, that are pre-configured, and basically are configured templates for learning these kind of architectures.
And in the serverless GitHub, we have most examples for learning these kind of solutions. We can find how to program our Telegram bot, for example, in Amazon,
develop our API, our REST API with DynamoDB, for example, that is a database for Amazon. And finally, these are the reference for making the toll, and that's all.
These are four conclusions. Basically, serverless architecture. Using serverless, we can improve microservice architecture, eliminating the need to have the service out of active. And, well, serverless provides many advantage,
and the use of serverless computing maybe is increasing in SDRs. And that's all, thank you.
We have time for maybe one question. Okay, regarding these kind of architectures, I have found with my team is that we had an issue with external dependencies, because usually when you are in Amazon or you are in Google Cloud,
when you depend on third-party libraries that sometimes are compiled, they really deny you to install. Do you have this issue at some point, or? An issue lacking with third-party libraries. So when you get into this architecture, while you are doing pure Python, are you able to import third-party libraries,
because my team has been always having trouble with this? I have not been in trouble with third-party, but... I mean some PyPy compiled models, or whatever? Yeah, PyPy, yeah, you can install whatever library that you need. If the dependency is in PyPy, there will be no problems.
It's automatic, so it takes a requirement. For us in Google Cloud, it failed, basically failed. So that's what I mean. And how easy is it to remove from this kind of architecture and to return if you say it's a mistake? For remove, this frame... For changing, for switching. For remove, this project provides the command tool.
Yeah, for example, for getting out from Amazon and moving to another provider, or just moving into your own server. Yes, you need to run our own premise on your servers. All right, I'm afraid we don't have time for any more questions. Let's give another big round of applause to Jose.
Thank you.