 Selamat tinggal, semua. Saya Yos. Hari ini saya akan berkongsi dengan anda aplikasi yang berjumpa dengan framework server. So, ini akan berbincang-bincang dengan apa yang server ini tentang. Dan juga akan berkongsi dengan lebih detail apa yang ada aplikasi server yang berjumpa. Jadi, mari kita mulakan. Jadi, pertama-tiga, apabila kita berkongsi server, tidak bermakna bahawa tidak ada server yang berjalan-jalan. Mereka memang masih ada server yang berjalan-jalan. Tetapi, perbezaan adalah sebagai perkembangan, anda tidak perlu berfikir tentang server ini. Anda boleh berhati-hati pada aplikasi anda dan pada kota anda, dan lebih kurang keadaan infrastruktur dan aplikasi server, aplikasi, dan sebagainya. Jadi, terutamanya aplikasi web ini ada front-end dan back-end. Dan Back-end kita berkongsi server secara tradisional pada aplikasi physical. Tetapi, pada beberapa tahun yang lalu, beberapa teknologi di layak platform, teknologi antara sistem operasi dan aplikasi anda, telah berjalan-jalan. Apabila kita mulakan dengan aplikasi physical, kita mulakan dengan aplikasi virtual dan aplikasi hypervisor. Kemudian, untuk mengambilkan kita, dan pada setiap keadaan perkembangan ini, kita bergerak lebih kena-kena kekosankan solusi yang kita tidak perlu berfikir tentang perkembangan serta-serta. Jadi, jika anda lihat di sini diagram yang sama, anda akan lihat bahawa kita bergerak kembali ke solusi yang lebih kekosankan, jadi, kekosankan blue bermaksud bahawa kita tidak mengambilkan diri kita. Seseorang lain mengandalkan untuk kita. Apabila kita bergerak keadaan perkembangan ini, kita menggerak lebih banyak kekosankan semua pelajaran serta-serta kekosankan ketiga yang lebih kekosankan lebih baik mengandalkan kita dan mengambilkan juga. Jadi, dan perkembangan berikut di perkembangan ini adalah pelajaran serta-serta atau fungsi sebagai pelajaran. Jadi, fungsi sebagai platform pelajaran membuat anda mengambilkan dan mengambilkan pembunuh, bermaksud penghantaran yang mengandalkan pembunuhan. Jadi, platform pelajaran serta-serta adalah fokus pada mengandalkan pelajaran serta-serta. Dan perkembangan ini akan mengandalkan 24-7 selalu mendengar pembunuhan. Selain itu, anda membuat pembunuhan sepanjang bulan. Tetapi dengan pelajaran serta-serta, fungsi akan mengambil apabila anda membuat pembunuhan apabila anda membuat pembunuhan. Dan ia mengandalkan apabila pembunuhan mengandalkan. Jadi, cara platform pelajaran serta-serta seperti AWS Lambda Work adalah anda mengandalkan pembunuhan pada platform pelajaran serta-serta. Anda dapat mengandalkan pembunuhan yang pembunuhan akan mengandalkan untuk mengandalkan pembunuhan anda. Untuk contoh, anda dapat mengandalkan pembunuhan untuk mengandalkan pembunuhan dan sebagainya. Dan platform pelajaran serta-serta akan mengandalkan semua pembunuhan horizontal pada hal itu. Mereka akan mengandalkan banyak proses fungsi sehingga ada pembunuhan yang akan datang. Ya. Dan tentu-tentu anda hanya mengandalkan apa yang anda gunakan pada masa pengalaman dan sepanjang pembunuhan sebenar. Jadi, bagaimana pembunuhan ini mengandalkan pembunuhan? Apabila pembunuhan alam digambarkan, pembunuhan adalah pembunuhan dengan sesetengah pembunuhan yang ditutupi. Dengan sebagainya, dan pembunuhan adalah setaian yang mengandalkan pembunuhan. Tapi ia mengambil masa untuk mengandalkan pembunuhan untuk mengandalkan pembunuhan sepanjang proses pembunuhan. Dan ini menyebabkan sesuatu yang disebabkan latihan kota. Yang adalah pada pembunuhan yang pertama untuk mengandalkan pembunuhan sepanjang pembunuhan sepanjang pembunuhan, ia akan mengandalkan lebih banyak masa kerana ia perlu membuat semua pembunuhan dari kota. Berapa lama anda mengandalkan pembunuhan? Ia akan bergantung pada masa pengalaman dan pembunuhan. Contohnya, beberapa pembunuhan seperti Java akan mempunyai masa pembunuhan yang lebih lama. Saya rasa ia boleh menjadi... Saya tidak ingat sepanjang pembunuhan. Jadi, anda mengandalkan 20 milik segi. Jadi, 20 milik segi? Ini untuk pembunuhan yang panjang. Ia mengandalkan pembunuhan panjang. Jadi, saya rasa jika saya ingat dengan betul-betul, untuk Java, ia akan membuat sepanjang pembunuhan atau sesuatu? Anda akan membuat sepanjang pembunuhan pada 20 milik segi. Pembunuhan. Itu tidak sebab ia membuat pembunuhan. Itu sangat berkeluar. Saya rasa ada pembunuhan yang berkeluar seperti pengalaman yang membuat pembunuhan yang panjang sepanjang pembunuhan. Kita hanya mempunyai pembunuhan yang panjang. Dan pembunuhan ini tidak mempunyai pembunuhan yang panjang. Jadi, saya rasa anda akan mempunyai. Jadi, 20 milik segi. Ia sangat menarik untuk melihat pembunuhan dan melihat pembunuhan yang berkeluar. Ya, ya. Ya. Ini berkeluar untuk beberapa platform dan untuk beberapa pembunuhan, saya rasa. Bukan untuk AWS Lambda, saya rasa. Baiklah. Paling kurang untuk... Sebenarnya anda boleh mempunyai 50 milik segi. Selepas ini, ia hanya berkaitan dari Adrian Crockford. Walaupun ia berkerja di AWS, tetapi ia lebih berkeluar sebab anda boleh mempunyai 25 milik segi. 10 milik segi. Sebenarnya ia berkeluar 50 milik segi, saya rasa. Jika anda mempunyai lebih banyak proportion, 20 milik segi. Saya rasa ia lebih banyak proportion, 20 milik segi, 20 milik segi. Selepas itu, anda boleh panggilnya sebagai pembunuhan yang berkeluar. Pembunuhan yang berkeluar, ia masih berkeluar. Tapi setidaknya, 50 milik segi adalah, saya rasa, apa yang AWS berkeluar sebagai pembunuhan. Pembunuhan. Ya. Baiklah. Selepas pembunuhan ini, selepas ia berkaitan, ia berkaitan dengan pembunuhan, platformnya akan mempercayai pada masa-mengatanya. Jadi ia tidak berkeluar dengan cepat. Ia akan berkaitan untuk melihat perangkatan untuk keadaan lain. Dan jika ada perangkatan lain, ia tidak mempercayai semua pembunuhan dari scratch. Ia hanya menggunakan pertahanan yang sudah dihubung. Dan ini sehingga lebih cepat kerana anda tidak perlu memulangkan dari scratch. Jadi ini adalah pembunuhan Lambda, pembunuhan Lambda yang digunakan. Ini hanya pembunuhan. Ia mengambil beberapa parameter. Jadi pembunuhan ini hanya untuk pembunuhan. Contek yang anda gunakan untuk membuat bahan matadata, seperti melihat seberapa lama pembunuhan telah bergerak. Pembunuhan itu hanya pembunuhan yang anda gunakan untuk menerang kembali ke mana-mana yang anda panggil. Jadi ia hanya pembunuhan. Sebelum kita melihat kenapa kita patut pergi atau kita mungkin mahu pergi bersihkan kita. Jadi pembunuhan kembali secara tradisional mempercayai pembunuhan fizikal. Dan pembunuhan ini mempunyai pembunuhan. Kita perlu menghubungkan kemahiran untuk membuat cukup kemahiran untuk menghubungi semua pembunuhan anda. Jika anda tidak, perkara yang terukah dapat berlaku. Jadi bagaimanapun dengan pembunuhan tradisional, anda dapat sepanjang masa untuk mempunyai pembunuhan. Kerana jika anda mempunyai pembunuhan, anda tidak dapat menghubungi semua pembunuhan. Tapi pembunuhan pembunuhan adalah anda mempunyai untuk pembunuhan pembunuhan. Anda mempunyai untuk pembunuhan yang anda tidak benar-benar menggunakan. Dan kerana dengan pembunuhan tradisional, anda tidak dapat mengubungi kemahiran anda dengan cepat. Anda akan masih memperkenalkan kemahiran semasa anda memperkenalkan pembunuhan tradisional yang mempunyai kemahiran anda. Jadi, ini tidak sempurna. Tapi dengan pembunuhan tradisional, pembunuhan sebenarnya akan menyebabkan pembunuhan tradisional ini. Sebenarnya. Kerana pembunuhan pembunuhan akan mempunyai beberapa pembunuhan dengan beberapa pembunuhan. Jadi, anda tidak mempunyai untuk pembunuhan pembunuhan. Jadi, bagaimana anda dapat menggunakan servis? Anda dapat menggunakan untuk api, untuk belakang. Pembunuhan tradisional dan ia menarik untuk beberapa pembunuhan. Tapi pada masa yang sama, ia tidak menarik untuk beberapa pembunuhan. Di mana, bagaimana anda perlukan banyak pembunuhan atau mempunyai pembunuhan pembunuhan yang lebih daripada pembunuhan pembunuhan pembunuhan servis? Jadi, bagaimana servis yang baik? Anda mempunyai pembunuhan pembunuhan. Kerana lagi, pembunuhan pembunuhan untuk mempunyai banyak pembunuhan yang anda perlukan. Jadi, anda tidak perlu mempunyai pembunuhan pembunuhan. Ada lebih kurang pembunuhan. Sebenarnya, anda tidak perlu risau tentang pembunuhan pembunuhan pembunuhan pembunuhan untuk pembunuhan pembunuhan dan mempunyai pembunuhan pembunuhan dan sebagainya. Kerana pembunuhan hanya menghantar semua ini untuk anda. Ia juga mempunyai pembunuhan pembunuhan. Selain itu, setelah 24-7 pembunuhan pembunuhan pembunuhan tradisional, anda membuang 100 milisekad pembunuhan sehingga anda hanya mempunyai masa pembunuhan yang anda gunakan. Jadi, saya rasa pembunuhan pembunuhan pembunuhan lebih kurang. Jadi, untuk pembunuhan pembunuhan pembunuhan, jika anda mempunyai mempunyai 128 milisekad pembunuhan, untuk setiap 100 milisekad pembunuhan, anda perlu mempunyai 0.0, saya tidak tahu bagaimana pembunuhan pembunuhan pembunuhan. Dan sejak anda mempunyai ketiga-kota pembunuhan pembunuhan setiap bulan, sebenarnya anda dapat memperbaiki tiga-kota untuk mempunyai pembunuhan pembunuhan. Bagaimana anda memperbaiki tiga-kota pembunuhan? Pertama, anda memperbaiki pembunuhan pembunuhan sehingga anda memperbaiki pembunuhan pembunuhan untuk pembunuhan pembunuhan. Anda memiliki keadaan yang anda memperbaiki kepada seorang pelajar lain, tapi saya tidak rasa ia adalah adalah peng사ian, kerana mungkin anda bercerai secara sepanjangnya dan tidak mengerikan. Pada masalah terbiasa keadaan yang diperbaiki dan diperbaiki, anda hanya memiliki keadaan yang berbiasa keadaan yang diperbaiki. Pertex, suatu hal emas adilnya adalah tiga minit saya rasa, tiga minit. Jadi itu sebabnya ia tidak yang menunggu untuk terserahansi. Dan anda tidak boleh bisa begitu bersarung. You have some control over memory but you don't have much control over disk space. So, serverless functions have a maximum disk space of 500 megabytes and you can increase or decrease this limit. Finally, decentralization. So, I think this is more of a general challenge with distributed systems. For example, integration testing is not easy for serverless because you have to simulate a lot of the infrastructure that you rely on. Also, making sure that testing different separate subsystems is generally not as straightforward as testing one system. Likewise, you can't open a debugger into your function instance. For example, you have to make sure if you're good monitoring and logging. So, these are the challenges of serverless. So, these are some of the limits of AWS Lambda. So, if the maximum disk capacity. So, these things you have no control over. So, next, we look at the serverless framework, which is CLI that helps you build serverless applications. So, out of the box, you get structure and best practices. You basically group, have this idea of a service, which is a group of related functions. Get some automation to get your applications deployed. And you get a plugin ecosystem where you can extend the framework's behavior. It has an active open source community. And it's also provided agnostic, meaning that it has a common API for interacting with different serverless platforms. So, it has a spot for AWS, but also other cloud platforms. So, yes, so these are the three key abstractions of this framework and just servers in general. You have events that trigger functions, which may communicate with some resources. So, resources are just cloud services that you use to store some kind of state. So, functions are just a piece of code on the cloud. So, it's a function that you package to a zip file that you upload to the fast platform which the fast platform then uses to execute code. When designing functions, I think it is important to have for it to be a single purpose function. So, you can think of the UNIX philosophy where we have many small programs that interact, play well with each other that you can just wire up to build more powerful pipelines. Each serverless platform has different languages and runtimes. So, we've already seen this. So, this is Node.js Function. So, for AWS, these are the available languages and runtimes that you can use. So, you have Node, Java, Python, and .NET. So, the next key abstraction are events. So, events trigger functions. So, think of it as like the signals in the neurons and your brain, something like this. So, on AWS, these events could include DynamoDB events. For example, when a new row is inserted, you could trigger a function after that event or when a new file is uploaded to S3 and so on. So, these are the events available for AWS Lambda. So, for example, you could trigger based off of HTTP and so on. So, finally, you have resources which is just some spotting cloud infrastructure that you can use to store state because functions themselves are stateless. Any in-process state cannot be guaranteed to continue to exist in the subsequent invocation. So, that's why you need to store these state in a separate either an external database manage NoSQL database or an external network file storage system or an external API and so on. So, before I go to the hands-on, I also would like to show you the serverless.yaml file. So, this file is key to the serverless framework. This is basically a DSL that describes the shape of your serverless applications. So, yep. So, let me just go straight to the hands-on. So, in this hands-on, I'm just going to quickly show you how you can get started with the serverless framework. So, here, we're using the CLI to bootstrap a new project with a given template. We call our service MyService. So, let's look at the service. So, serverless will generate a couple of files. For you, let me just close this. So, this is the serverless.yaml file that we've seen. Is it visible? We've seen. So, if you look at this file, so this just says that we have a service called MyService, which uses a given fast provider. In this case, we're using AWS. It describes the runtime that we're using. In this case, it's Node. And because server is agnostic, this could be other platforms, like the other platforms, which I will not name. And we can also... So, here, we also define functions. So, here, we have a hello world function whose source code is in handler.js, which is a function called hello world. And this function, hello world, can be triggered by an HTTP event to the path get slash hello world. So, this is basically what our service looks like. We could, of course, have other functions here, like get hello. And we can go... Yes, we can define multiple functions. So, this is our handler file in this case. So, this is just another function, hello world. And in this example, we're just returning a HTTP response with a message and the original event. So, this is... And we return the result in the callback, basically. So, we can use the service CLI to... Oh, it... So, this is not an exhaustive example. But... So, you have other options as well, for example, a region. Define which AWS region you can deploy this to. And you can use the CLI to deploy our application. So, this will take some time. And in the meantime, so behind the scenes, the server CLI will transform this DSL to... in case of AWS, it's a cloud formation. We will create a cloud formation template of all the resources that this will require to support this application. So, for example, in this case, you have an HTTP event. So, behind the scenes, the server CLI will create an API gateway resource automatically without you having to worry about it. And likewise, if you have other event triggers, for example, you could have a SG event, for example. The server framework will also create a bucket if it doesn't exist already. So, let's look at the progress. So, here we see that the server CLI is basically creating couple of different AWS resources, in this case, cloud formation, gateway and so on. Any questions at this point? Is it anyway we can connect with DynamoDB from the server to the function? Yes. So, where will you store the credentials of DynamoDB at the moment? So, whatever the curve is, I want to show where you keep the credentials of it. So, I want to connect with DynamoDB where will be the credentials, how we connect the credentials. Any index industry practice? You can include the ARN of the table. If it's an existing, you can either create a new table within the application itself or you could have an existing table. In the case of existing table, you can just have an ARN of the table, the address of the table basically in the AWS space and create an IAM role that you give to the function to have access to the table. Okay? Ya. So, if the intention is to understand how we can have secret base, we can have environment variables and send them using KMSP. Yes, you can also do that. That's one way to have the secrets embedded into that. Ya. So, you know, how could we display in the AWS but I want to display the mobile machine. Mm-hmm. So, let's scan how it runs. So, for example, so, in serverless, we have a couple of helpful commands not just deployed for deploying stuff. We can also invoke the live but of course, if you, if in your function, you call an external API, you will call an external API. Ya. So, yep. So, I have the right of view function and this function working together and I just want to call this function with that something locally. Yes. Before. Ya, you can run it locally. So, it's invocable at all. Sorry, you can just call it invocable call the function locally. So, we will see an example of a test data. Ya. Why does the building starts? Because there are some resources being started here. So, does the building starts at this point? Depends on the resource. So, for example, if you provision S3 bucket and the bucket is empty, you don't pay for anything. Ya. It starts. Ya, it could. Ya. Okay. So, we finish deploying. So, because our function can be triggered via HTTP, serverless created an API gateway and we have a URL that we can use to trigger our function. Basically. So, if we just go to this function and say, hey, so you return so, so we just call our function and it gave us a response and you can see that the input event is pretty detailed. It's basically an HTTP request. Ya. And it took us about 300 milliseconds. So, this should have been the code start. At least, ya, it's the code start. It's still pretty fast, I guess. So, in the second invocation, it's the hot invocation. And basically, for the next subsequent invocation, it's hot. You can see the time is lower than the code start. So, that was the code start we can see. And that was basically how you can get started with serverless framework. Okay. So, we'll look at a more involved application later on. So, so that was the basics of how you can get started with serverless framework. So, next, we'll look at a more involved example of building an event-driven pipeline. So, imagine that we're building an image processing backend where users would supply an image to our backend. And our backend would do some analysis on this image, do some processing and basically generate this new image. So, how can we build something like this using just functions of code? So, we're going to use AWS and serverless. We're also going to use a couple of different AWS services like S3 to store files, DynamoDB and recognition to do some image recognition. So, one of the things I learned about after playing around with servers for a while is that it's important to decompose your problem because, when you have a big problem, you split it into smaller sub-problems and then you split those sub-problems to even smaller sub-problems, then you just solve the smaller sub-problems and eventually you get there. You solve it, everything. And likewise, how can we decompose our image processing backend to just a set of functions, small functions? So, for each type of our pipeline, we could create a function that is just just in charge of that specific discrete purpose. So, analyze the image would be a separate function. To process the image would be its own function and so on. So, because servers, so this is what I, the point I'm trying to make across. It's for servers applications, I think it is important to split your application into many granular functions. So, if we go back to this idea that events triggers functions and resources, how would we create the image processing backend? So, the first step would be how can we let's say that the user supplies an image URL. So, it's a, the address of an image living somewhere on the web. And we need to save this image. So, how would that step look like? We could create a new function just for downloading the image to a bucket in our infrastructure. So, it's triggered by an HTTP event. And what it does is it saves the image to an S3 bucket. And in the process it creates a new S3 event. So, an HTTP event triggers our function which communicates with an external S3 bucket. So, the next step now that we have an image is how do we analyze this image? So, we could create a separate analyze image function. So, it's triggered by the S3 event to create a new image being updated. So, what the function does is just calls the recognition API to just return some analysis results for the image. And it would write these results to a DynamoDB table. And so, as a result it would emit a new DynamoDB event which could be used to trigger the next function. So, now that we have the analysis results let's combine these two information. So, this function this process image function is triggered by yet another event a DynamoDB event and it does the image processing and it saves it to an S3 bucket and it emit another event that could be used in a future to trigger other functions. So, again, events, functions and resources. I'll skip this part. So, what we get out of this an initial event invokes a function triggers a function which triggers an event which sends an event which sends an event which then triggers another function and so on and so forth. So, this is one of the interesting design architects possible design architectures made possible with server functions. So, what do we get out of this? Well, we have backend with less ops. We didn't have to specify a server configuration or provision any servers. So, it's very fast to develop. Start developing. It's horizontally scalable. Again, the AWS the server platform will spawn as many function processes as there are incoming requests. So, you don't need to worry about scaling on your side. AWS will also ensure that your server is always up. You have a process manager running somewhere. And it's also cheap because there's no like large instance running 24-7 somewhere. It's the functions are just spawn when there are requests. So, nice. So, what other things can we build with serverless? So, so this is one application that we've seen servers as a processing where in response to an upload to an S3 bucket, it triggers a function that does some computation. You can also use it to create serverless backends where you can imagine each restful endpoint could be handled by a separate function. So, for example, a post-slash-users endpoint could be handled by a create-user endpoint and so on. And you can also there's also this pattern called the astrangular pattern where you slowly extract individual endpoints in a legacy application and migrate each endpoint into a separate function individually. It's this one path you can take to solely migrate a legacy application. And you can also use a GraphQL. You could have a single Lambda function that is your GraphQL server. And there. Okay. So, before I finish, I'd like to show you the more involved example. So, this is the image processing backend. So, basically what we're doing here is so in order for the function to be able to access any cloud resources that you use. For example, an sg bracket or DynamoDB table. It needs permissions to access it. So, you have to define IAM roles to basically give access to these resources for the function. So, for example, in this case we're saying that our function can do these things for a set of tables. So, we have many functions. We have a download image function which is triggered by HTTP. We have an analyze image function which is triggered by an S3 event of a particular bucket. And it's only triggered when a new object is created in this bucket. You can also add other roles. This is triggered only if it has a particular prefix. The process image function is triggered by a DynamoDB event of a particular table. Yes. So, each function could be triggered by many different events. And so, functions are just functions not very interesting. We could have a test, for example So, for example, in this case we're just executing the actual function with any external API request mod. So, we can run it without having an open connection or modifying state somewhere else. So, for unit test I think for serverless application it's manageable. But for integration test it's I think it's still an open question. So, in summary we learn how serverless came to be what serverless is all about. The benefits and drawbacks we learn some of the basic concepts like events, trigger functions that communicate with some resources. We learn about serverless framework and how you can get started with it. And you saw the process of building a more involved application which is an event-driven pipeline. That's all I have to share for today. Thank you. Can you put the board in the GitHub or something? It's kind of private. So, yeah, if you have... I think for this application I'm not using any secrets but you can specify environment variables here, for example. My question is more around how does it know what the interface profile to you? Ah, okay. Yes, yes. So, there is actually a default option here like this. Okay. But default is like this. It basically checks your... I don't want to say... Basically it checks your interface slash credentials. Yeah. Yeah, that profile. But you can obviously change to something else. I didn't find the specified... Or it's a default option like this. Is there a way I could write the same function to make money out of this? Can I get this marketplace? Sorry? Aha. But you can already just create an API and post it on an API marketplace. To monetize a function? Yeah. There is also an upcoming platform that is steadily, I guess, where you... the end goal is like an NPM package if you are in the JavaScript world or like see that as any kind of package management where you could install your function. So if I... I don't want to do that. I don't have a need I can write some function where there's something... Sooner. They can charge it or they can pay me some third family person. Like an app store. There's no such... there's no such platform yet? Yeah. I don't think there's a platform for this yet but I know some people are working on it. Yeah, kind of. Maybe you can work on it. You can work on it. It's a good idea. I need to write a function on it to monetize it. Not yet. Okay. Any other questions? So maybe we can have teeny tiny break of five minutes if you want to have a drink or...