Practical serverless development for beginners | Rakesh Gupta | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Practical serverless development for beginners

teacher avatar Rakesh Gupta, Help companies building cloud products

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

30 Lessons (1h 49m)
    • 1. Introduction to the course

      1:07
    • 2. Meet the instructor

      0:50
    • 3. Starting up with an AWS account

      1:42
    • 4. Securing your AWS account

      2:42
    • 5. Course roadmap

      1:23
    • 6. What is DynamoDB

      1:21
    • 7. DynamoDB basics

      4:15
    • 8. DynamoDB - Partition key and Sort key

      1:36
    • 9. DynamoDB hands on

      3:52
    • 10. What is AWS Lambda and how it works?

      2:22
    • 11. Lambda basics (hands on) - Part 1

      8:15
    • 12. Lambda basics (hands on) and AWS Cloudwatch - Part 2

      3:47
    • 13. Sorting out DynamoDB permission issue with AWS IAM

      6:12
    • 14. Writing data into DynamoDB using Lambda

      8:05
    • 15. Updating data into DynamoDB using Lambda

      8:38
    • 16. Getting data from DynamoDB using Lambda

      6:05
    • 17. Deleting data from DynamoDB using Lambda

      3:29
    • 18. What is an API Gateway?

      1:08
    • 19. How API Gateway works?

      1:25
    • 20. Setting up your first API

      7:52
    • 21. Setting up remaining APIs

      5:06
    • 22. How to access your APIs and Getting your inventories - Postman

      3:29
    • 23. Add an inventory via Postman

      4:46
    • 24. Updating, deleting your inventories and a quick recap

      5:01
    • 25. Inventoria app introduction

      1:17
    • 26. Inventoria app setup and configuring your endpoints

      5:26
    • 27. CORS and adding headers

      3:12
    • 28. Local serverless development and test using Serverless framework - an intro

      2:41
    • 29. Course wrap up

      1:34
    • 30. What next

      0:42
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

134

Students

--

Projects

About This Class

Serverless computing allows you to build and run applications and services without thinking about servers. With serverless computing, your application still runs on servers, but all the server management is done by cloud providers (in this case AWS). Serverless lets you focus on your application code instead of worrying about provisioning, configuring, and managing servers.

You will being with a 10,000 feet overview of cloud computing and serverless and then get your hands dirty with real serverless development. You are going to build an imaginary inventory management services "Inventoria".

Once you have understood cloud computing and serverless, you are going to build and assemble all the pieces together to create real endpoints.

You are going to understand serverless database DynamoDB and how it works. You are then going to design and create the table.

Once you have designed your database, it's time to create microservices and you are learn AWS Lambda to create inventory servcies using Node.JS 8.10.

It's time to create endpoints, so inventory services are consumed by any front-end or consumer applications. You are going to explore AWS API gateway to create endpoints for your inventory services.

Once all the endpoints have been created, it's time to test them, so whatever you have created works.

Action time to integrate all your endpoints with an Angular 7 app (it can be any front-end application, you might choose to integrate with). You will also examine serverless frameworks for example serverless and AWS SAM (Serverless Application Model), so you are ready for serverless development locally.

At the end of this course, you are fully aware about serverless and serverless development using AWS. You can expand this further with Azure and Google Cloud.

Meet Your Teacher

Teacher Profile Image

Rakesh Gupta

Help companies building cloud products

Teacher

Rakesh Gupta is a Cloud and serverless developer, Architect and helps companies building awesome user experience product.

Rakesh has been consulted by various companies for building Cloud, IIoT, Angular and Serverless products. He advocates UX a lot and seen advocating for user experience in his consulting assignments.

He loves to teach, mentor, building teams and had given lots of talks at local meetups. He was in the winning team of Sheffield, UK, Startup Weekend, Techstars.

.

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction to the course: Welcome to my course. Practical, civilised development for beginners. I'm so great to have you on a boat. In this course, you are going to learn several s development using AWS. Although many cloud computing platforms in the market, for example, azure from Microsoft and Google Cloud from Google to our discourse, you are going to learn individual building blocks to create a several s application Micro services, ap eyes and testing those AP eyes using a free tool called Postman, I have created a bonus lecture on how to integrate those Ellis AP eyes do an angular 7 50 is inventory inventory A. This inventory management system allows you to manage your in countries whether it is, you know, new inventory, updating and adjusting entry, deleting on inventory. I'm so excited to have it in this course again and I'll see you in the next lecture 2. Meet the instructor: Hi. Welcome to my course. Practical, civilised development for beginners. I'm rockets on on your course instructor. I have a cloud and serverless developer, architect and I helped companies building amazing usual experience product. I have created this course out of my own problem off not finding a minimum requirement course to get started on several its development. You don't have to be an expert in softer development, but I would highly recommend having a knowledge off JavaScript. Please bear in mind that it's a practical serverless course on musical as you go along. Throughout this course, if you are stuck on having difficulty understanding anything police supposed to understand Q and A and unanswered back. Thanks again for joining this course and let's go on this journey together. 3. Starting up with an AWS account: Let's create an account with eight of the West. Go to google dot com and type Amgen Web services. The search results will tell you Amazon Web Services website, and once you go to the website, you will see create an account. But coming up after right hand side of the page. And you can also go to the what what we dear offers because the moment you joined AWS that it actually gives you facility to try edible, where services for 12 months or one year, you can also see work. This free dear offers on you can see and feel off. The resources are going to be completely free throughout your life. Uh, and of course, it'll Lewis offers and defines what is free, and you can go to different, different options to check what it's really like. What is always going to be free O. R. One will be free with my 12 months trial, and they're absolutely You can actually find all the details by visiting all these steps toe like engine connect. And once you have signed up, be remembered that Amazon is going to ask you details about your credit counter, any sort off medium so you can be verified. You won't be charged, but it is just a matter off when you are ready after one year and if you are spending inedible with resources, you can be charged using your account and God details. 4. Securing your AWS account: okay. And the last lecture we created Adam Lewis account. Now let's go to the AWS weapons again and sign in this time if you notice when we go to and he was spit, it changes to sign into console. And now we can use our 10 seals to log in to our AWS account. And remember, this is your root account. We haven't secured it enough. Now, in this lecture, we are going to secure it enough. And every time, once we enter your our credentials, then we are going to protect it somewhere different options here, green orange. And I'll encourages you to make all green. In this case, we are going to set up a virtual authentic isn't device so go to continuing to security credentials. And she was multi factor authentication on here. A couple of options. Virtual device, UDF security key. Other hardware device. In this lecture, we are going to set up virtual benefit device in this case, Google authenticator different to choose Google on IOS or Android actor guy. Now it will show you the scan on once the moment you scan is gonna ask you first to innovate Gold one and two So what I'm going to do is I'm going to enter my first to renovate code. You just have to wait a few seconds when the second court changes. Andi. Now, once agendas, you have toe enter those details here on a sign. Everything. If it is successful, your options are green. And then it will say, and you're you have activated your virtual two factor authentication, that's all. Now, if you go and sign out and sign back in, this will now ask you to enter your authentication growth that you have just configured in this case, Google authenticator. In your more buying, it could be iris app. It could be enjoyed app. Since I have logged in successfully, it will ask you for an effect code. And once you enter this scored, you are going to sign in so nobody can sign in if they don't have em. If a code this is that's all for this lecture on. Then I'm going to see you in the next lecture 5. Course roadmap: welcome to the course roadmap In this section we are going to talk about cloud computing and wanted several is in general. We have them going to practice on no more about several estate of heiress Dynamodb. We're going to create those business logics on micro services using AWS Lambda using no jets. We are then going to create endpoints which will call the micro Services and Micro Services Intern will be calling Dynamo TV once we have pretty All those in points will be testing all those and points using a free to called postman at a business lecture. We are going to discuss all about and integrate on those end points in a really practical angler. Seven app in Victoria app And then we also will be learning how to host. It was anger. Seven ap at the static website in s tree, which will be calling a B I gateway Lambda on Dynamodb at the end of this course will be touching briefly about several s framework on how to develop locally. And then, at the end of the lecture at the course, wrap up will be talking about and what we have London couple off links. I'll be shared 6. What is DynamoDB: so welcome to Dynamodb. So what is Dynamodb? Dynamodb is a fully managed, no SQL database services. Andi. It is completely several lists. That doesn't mean that you don't have to perform any hardware provisioning, and he set up any conflagration or any patching. You don't have to worry about it. A double racist manages on behalf of Hue. It provides fast and predictable performance so you can actually get to know what, and you can predict your performance and everything It can be skeleton and up as a traffic bigs up and down. Scaling. It's seamless. It is just kind off switching on a couple of conflagrations, and then you should be able to scale it up in town. So just a normal did of it. But it is no ask you a little bit. We'll be discussing What about dynamodb in the next section, But you can create database tables that can store and retrieve any amount of data, and so any level off request traffic if requires on. As I said, this is completely several lists. You don't have to worry about any Harvard provisioning or anything. Once we have set up and create a table, you are ready to go on to be consumed in your business. Logically, 7. DynamoDB basics: Okay, so here we are. As I said, Dynamodb is a no SQL database, so structures are more or less Jason object. So you can see here all the like usual and post collection way are saying collection here you can you can say table or rule here in terms of their dynamodb that as as you can see, these are these are nothing but Jason objects now to go to dynamodb, go to bed of Louis console and type dynamodb, and then you'll be arrived on the dynamodb bit. Now, the bottom point is region that there's a concept of reason in delivery services and you see a lead services at the right hand side of your screen. In all the regions you can find, you can learn more about dynamodb and everything here. But if you come to region, you can go to any reason you choose to for this lecture, we are going to practice in our land reason what I choose to create everything you can choose to create any region or anywhere. You want to create a dynamo magician table. Now just create table create on this button on Go to go to this table creation, Scream and what? What? What does the screen tells you that you need to define the table name and this is any table then you would be doing in your previous Web development or any sort off table or did obviously didn't work. Doubling is kindly self explanatory. This is inventing table. So what? We are going to create this kind of inventory inventory? A, as I said, and this is a partisan key concept here, and it can be off string or a couple of other types. As it's a stream boundary on number, you can choose what we're going to choose i d. As a number here. There's a second concept in Amedee camp called sake. What is the sake? Is a kind off foreign T or composite key in other RGB Miss one so you can combine I d with other sake, and he had different table settings. You can choose to opt. We'll just leave with the current default setting, and we are going to create a dynamodb table here. It's going to take some time, so why table is being created? I run to all the Nativity off dynamodb concept, so as as I said, as as I said earlier that there is a concept of reason that you have to choose. And then once a table is created, you will see your primary key coming up here. And if you have defined a sake, you will actually see sake coming here. You can choose different, different options. You can create item by clit item. Let's let's see all those waters. All the steps are it's all of you. Get information about a table name your primary partition T point in time recovery on different other properties off this dynamodb table on the frequency. Prison re capacity units five provisioned drive capacity unit five pieces. Desist. If all this is Aaron concept in dynamodb and edible with services in general items, you can create item here by kitten on cleared item button. You can see alarms because this will be mapped with your club watch to concede capacity you can see in Texas. Then you can see all the options. What? This couple tables backups and triggers what we are going to do. Here it is. We're going to create some item just for demonstration purpose. On what? On what? They're going to quit 8. DynamoDB - Partition key and Sort key: in the last lecture we created dynamodb table on created partition P. Now let's let's examine what this what This partition key and sake's are in dynamodb so but isn't generally a unique identification for table items on. Please understand this from the primary key perspective. So primary key helps you to find your data quite easily and quickly. Sake. Just like a composite primary key. Andi Off Portis is a normal concept in the database. Tema la Z composite Primary Key again helps you toe identify those records pretty quickly, But apart from partition key, you have a flexibility off using a salty, and that is completely optional. Partisan key is mandatory because this is kind of no SQL data and parties and helps to identify your data quite quickly, as as I have been emphasizing sake. If you have to choose the sake in your different scenario, just very mine, that is is kind of composite primary key, and you should be using in conjuction with your partition T. And it allows you do retrieve. Affect your data on the base off partition key and sake Boots on, and this is just kind off getting and getting better. quite quickly, but using competent primary key that that's all about partisan key and sake, and I'll see you in the next lecture. 9. DynamoDB hands on: Okay. In the last lecture, we have created a dynamodb table. We can go back to Dynamodb table and select our newly created table. We can go into this table and let's probably try to enter some inputs rows in this table. Off course we have then the properties. Other properties off this table. Just idea, is a primary king in here. So sake. And here we have this idea that a sake and what we have chosen as a number, let's let's try to add some more columns. Properties in Jason. So what we're saying Name so inventive. Name what we are choosing in some sort off in venturing names. Let's less chewed some sensible name, USB mouse. Then what we're going to add. Let's try to add a Boolean type, which said, whether this invent reason, stocks are not in stock and it's gonna ask you enter the details through our forms on Let's also I didn't defy Hominy items in the stock. How many are how many inventors in this to stop? Let's a little stock. It's 10 year. Once we have entered, all the required information will just save it on Dhere Design information. Let's just navigated through. You can see different options to add it. Why don't you click on idee? It will take you through the row off information. Here, you can choose to edit an information you choose to you'll see on at it. Icon coming up on you can decide, or you can choose to add it. All those information if you need to. Now what? What? We are going to create a different row again now. So let's see. How does it? So we have to use your tree and text, So if you go to text of you, it will be switched to just based on objects. Let's just copy that so we can modify for our next record on. Then let's enter some some more information. In the second, we'll wait so off course you can. You know, Jews to modify anything, so let's see what it is done. Now let's get another item. But this time let's go to all right Text, text view on bond on, modify all those information. Let's switch to text of you. Interesting thing is that if your idea it's same since your idea cannot be duplicated and if you choose and if you have modified order informations on the moment to you actually trying to save this information, you you are going to get some better. What you are going to get. You are going to get some sort off validation error because that idea banality suggests. And here it faced the conditions request field because I won only the just So what we have to do is we just have to give some another idea here and then once we have given the different idea and you say that there's a state on. As I said, you can choose to modify any record in dynamodb if you choose to modified. And that's all about this lecture will see more about dynamodb in the coming lecture where we're going to keep micro services. I've seen the next lecture. 10. What is AWS Lambda and how it works?: go now. We are here at AWS Lunda. So what is AWS lambda? Briefly. It is just a facility to create your micro services where you dried your business logic functions. It is also called function at the service. It was introduced in 2014. Reinvent. So they invent is an Amazon Web services event which retails annually and this is kind of biggest event in AWS. So it was render it runs scored in response to events. It can be STD B call. It can be sqs call. It can be f in a school and then it actually terms or runs Lambda. In response to those events, you can run your court virtually any type of application or back and services, all with Jiro administration. The benefit off Lambda is it actually provides you a platform where you run on right your functions without worrying about infrastructure. Now, how lander works so since as we already discussed, it is completely serverless. So you don't have to worry about sever or any infrastructure. But in the background, any function, you're right. It needs to be running on some sort of server, right? So how How Lambda works, it runs on your run time environment. So if you have configured ignored jets, environment, bite on environment or some different environment, it actually create on fly kind of continent localism. But AWS has something on their proprietary content of running services which actually ran to see your functions on return. Your all your results. Ah, by that. So that is What about how how Lambda works. If you have, you know, kind off load catching up, then it will create different containers on fly. And it will then and run all your functions and return all your function results to your calling program. This is all about Lambda. How Lambda works will We are now just going to learn more about yeah, to write Lambda Functions. I'll see you in the next lecture. 11. Lambda basics (hands on) - Part 1: okay, once you already log on to AWS console and we'll look for lambda. So this is this times a type lander. It takes you to the Lambda home, bitch. A couple of things. If you haven't treated any Lambda functions yet, you will see this a screen. And if you have to dig Lambda functions, then you'll see a list of lambda functions on this. A scream. Now, off course. When you can create Lambda functions by a couple of ways, either you can drink from scratch, you can use some sort off template, redefined templates. You can use some repository where you can check in, check out on bond. You can create your London functions. Pretty find functions. They are pretty fine functions. And if you want to reuse those functions, then you can reuse dysfunctions than than the plan will create. In this lecture, we are going to create a function from scratch. Since we are going to create kind of inventory application toe, let's probably right to function, which adds, uh, on inventory in the inventory table that we had created in our lecture with Dynamodb. Now what we are going to do is we are going to choose No Js eight point Or as are wrong time, they sponsor and functions. They need to know what a long time they need be executing now. Permission thing you every resource in lander where are or just artist. Everything in AWS runs on runs with a permission and I am permission. If you haven't existing rules, you can choose an existing rule. What we are going to choose? We are going to create a new role. Andi, you can actually define different different rules here. What What sort off rule a lambda would require to run its function. But off course, it exactly needs to have a kind of proper permission to run your land of functions on underlying the sources with inside a lambda function itself. So what? We are going to create a new rule with basically Lambda permission on that. What? What? What it does is that it is going to create a basic Lambda permission When we have created this Lambda functions, it takes some time to create a function. If you see it has, it has added a roll ad inventory code on some sort of Sleep it here. You can go to I am and verify this particular definition. Now, when this screen is loaded, you will see no Jace functionality or a snippet where you take sport. Art Handler is a kind off handlers to exports. If you have done tree drumming and javascript or nor Jesse, you might know about exports and how does it work? So exports exposes your functionality and hear what Andi to run on to get the response from Lambda. There are some specific form. It's that you need to adhere. S So this is so These are the facility is what we're running here. So a couple of snippets const response rhetoric was response. A couple of things here you can set environment variable. So if you have experience writing no, just applications, you might be knowing I am in variables here. The existing role basic settings we can set memory starts with 1 28 m B and can go up to three 1000 MB. Mystery Zeevi. You can actually a locket time out set to three sec, three me three seconds in Italy and then you can define your own time out period. You can choose virtual private network that we're not going to cover in this tutorial, you can sit concurrency and other things. So these are all configuration things you can configure. And this is a code snippet. What? We are running here? No, When you have pretty dysfunction on, if you want to test it, there is a little bit for personality you can test. So let's let's use Hello Will even template that that doesn't harm just just right. Just give even name, just just given even name. So function can, you know, be punctual, can choose this even to be, you know, kind of problem. And then since we're not passing and up any perimeters, so just leave it blank in the next lecture will probably come back on and leave. Is it this? But now you're ready to run. And when you run, you will see hello from Lamda Response Coming up. Coming out from this Lambda Functions function you have just written. So it's it's quite cool, right? So you don't have any infrastructure. You don't own any infrastructure. You have written you some no Jessa script on it runs somewhere it is running. So what? What happened to the background is that there is as as we discussed in the last slight that it it actually creates container on flyers. Runs that Norges It went 10 in woman dead from time there And it actually, you know, run, step, function there. And if you have some sort off some sort of dynamodb connection or something, then it goes to done with TV. It reads, writes or performs any sort of oppressions that you have defined in this lander. Now what we are going to do here we are just going to modify the masses a bit. So let's see what is coming. What is coming out from those you know? Even so, if you see hello from event and even G one value monkey to Valley two Key three value three . What we have defined when we have it in our, you know, just set up. So those those those pedometers we have defined while the confident are, you know, even to run on and then it actually gives you in the same way you can actually grab all your body very question body. When you want to grab your request body, you it actually comes to an event and off course, even an event actually considers every, you know, respond request body it has got. And then it actually displays all the other information from this Jason. So, yeah, if you see just everything What we have been discussing so far, what we have discussed so far is all about Jonah stood object petition, Jason, object. And on the basis of Jason Objects objects, we are creating our civilised application in this course off course. You need to be really mindful off your Jason from that, and it actually gives you so we have. So what? What? We're trying to stop this sort of data. You want to add into our dynamodb database and see, we have got i d. We have got name we have got is in Stark. We have got total in stocks on the base, off these giris on objects. We are going to build our inventory a on. So this is all about the basic functionality off Lambda on. I'll see you in the next lecture. 12. Lambda basics (hands on) and AWS Cloudwatch - Part 2: okay. In the last lecture, we probably talked about Lambda. It's working style and personality. In this lecture, we are going to know more about one of the properties, uh, called context and context. It gets you every detail context is that simple context in which context in on what context Islam dies is running. So context gives you a little bit more details about this land is running out. We are also going to add await keyword with the response this time this is acing request on . Now we are going to examine context briefly. Context gives you a couple of more information about context. This Sunday is running so you can get to know more about LA Group name. This is this has to do with aws cloudwatch lot stream. You can get to know aws request i d on this request idea is, as you know, independent on specific to a particular requested steps so you can get down and you can get all the details you need. You can also get to know the book idea, Aaron, etcetera, etcetera. As you know, a edible West resources have their specific and separate area. We're going to examine the locks and locks we can found Watch feature off AWS A couple of different options under blah blah Watch. You can see events, laws, metrics You can really down in your time and you can see all the details about cloud watch and everything You can see metrics And the metrics actually gives you all the details about off all resources. You can find more information about your specific lambda functions Here Logs gives you information about locks specific log since and logs specific to request idea that we saw sometimes back. And you can't really tell all those details in the logs itself. Off course you can goto different cloudwatch functionalities on resource. What, like Lambda? Maybe I get away. Dynamo db So what? We're going to examine more this kind of a specific lots. So let's go toe ground watch again. And what we want to examine this time is we want do examine a specific lark on this occasion. So let's let's go to locks on off course. We saw AWS request idea coming with every context. So if you go and examine this ad inventory logs, you will will actually see all the logs by request Heidi so and e find before they're all independent. Request idea with specific lander on the same idea. The same request I'll you will get to see. And if you are capturing all those details somewhere, you can get to know everything. You don't have to captain all the details because cloudwatch does all the heavy lifting for us. So here is the request is coming up. And that is all about Cloudwatch land. Another thing. 13. Sorting out DynamoDB permission issue with AWS IAM: So in the previous lecture we examined writing at inventory function on. But we are trying to add a record in our dynamodb table. Now we came across on error which is preventing our functionality to write into dynamodb. And because we don't have I am permission to write into this dynamodb table. You might say, OK, they are in the same region. So why we are not I will do agitating but understand that you have to have an I am permission role defined. And it is just to how you know, communication happens within AWS itself. And if we quickly examine, we have an execution roll ad inventory role. We just go toe I am roll ad inventory role and examine the role. So initially, when we examine this role, we can see we have just basic functionality to execute this lambda and locks, which is cloudwatch logs. So this can only run this function on and can create locks under cloudwatch locks. Now what we need to do is we need to add a permission so it can access of dynamodb inventory table and it should be able to write. So what we are going to do is we're going to choose a service in this case of dynamodb service, because we want you right into the animal dealing for the SEC off. Uh, I was understanding we're not just worried about access level. That's let's let all dynamodb t have action so we can write. We can list. We can delete. We cannot take anything. And what we're going to also say or resources are not limited to any edible Lewis Aaron or resources. In this case, I will have to give a policy name on be aware that this is an in line policy and not managed policy from AWS. So once we have defined the name of our policy, now that has, Bean added. And if we see we have full permission to add, update, delete or list any sort of information in our dynamodb table in this case ad inventory. But we have access for everything in this case. Now what we are going to do, you're going to test again and you see, this time it's successful. So the record has been written successfully into our dynamodb table. We just go to table the versatile bit and see number three I D. it's been written into dynamodb now, so because since it was missing, I am permission, we had to define that that that policy so it can communicate. You can do so now. You can do all other operations manually with dynamodb, and it's pretty pretty good, you know, kind of hands on. Now what we want to do here is that we want to get those values dynamically from a request body rather hard coded in this land of function itself. And if we see we have I d name isn't stock. All these attributes of what we have to do is we just have to get all those informations dynamically, as we saw in the last lecture, that how to how how even works and what what sort of information, even contents. So we are trying to extract those information, request body in this case, and so we can extract those informations dynamically off course. We can also move table and wasn't in vitamin into valuable and let's set up on environment available. Do Teoh get a dynamodb table name and let's let's define in here and now, as if you know, knowledge is only how to access those environment variables just by process, stopped involvement and be talked Your environment Variable name. And that's how you access environment available in knowledge is and the same approach works with AWS Lambda. Actually, we have defining about him. Invaluable. Now we have test. We're now testing it. So now when we see this, we still have started school 201 And once we repress this dynamodb What? What actually happens? Because what what happens is if we if we go to our best data, does I d one. So it had just replaced all those information. I just configure a different ideas so we can see dynamodb replaces. Uh, if it finds the same i d or same same sake in the request body itself. Now, if we tested, it should be It is it is successful and repress. Get a set. We'll see it This idea three It's successfully in our dynamodb table itself And this is quite good hand, John. In this course, we we learn toe configure environment variable getting those values dynamically. Onda, we have created working Lambda Functions function which adds on inventory in the dynamodb table. That's okay for this lecture. I'll see you in the next lecture 14. Writing data into DynamoDB using Lambda: off a couple of lectures we have been to London on. We know how London works be so even in context and how they work in this lecture, we are going to act real data into this dynamodb table. What? We created some lectures back and off course. Do you get access off this dynamodb? There is an AWS sdk for javascript off course. If you are using dot net core, I don't that is different Domesticate. But what we are going to use is this AWS sdk Yes, ticket gives you facility to access dynamodb or all other functionalities. Like if you want to access different features of AWS, you can get access off those features shooting into Lewis as the dates. Let's let's let's include the aws sdk in our gorgeous function. Lambda So off course is a common Jess. So we are including aws sdk. You don't have to worry about any kind of any being more deals here because that's a local lander environment. They take care of everything off course that this is some from salinity about the dynamodb talking implied functionality and everything so you can explore and I'm going to give all those links at the end of the lecture, so you can go through them. You can study them and you can use those functionalities. So too right data into a dynamodb table. We need to use a foot personalities that what is creating a new item. So first of all, we need to create an instance off dynamodb the document blind. So what we are going to do is create an instance off aws dynamodb and Document client. And since this lander on this year, dynamodb they are in the same region. So we don't talk to you. Specify any region that top off course. You can also specify region everything when you are defining or initializing your client. So by using this syntax, you are able to access your dynamodb. Just just just look it up just during development. So everything is working fine and you don't have any problems. So what we are going to do is we're going to the Skopje. This personality from this documentations put is responsible to write an item in dynamodb and what we are going to do is we are going to create a couple off meters that needs passing and of course, we need to define all those para meters here on perimeters like this, like we have already created and seen in the previous lecture. So let let's add those perimeters so we can define what sort of information we need to story are dynamo TV table. And this document helps you a lot. So just referred to this document. When you are in need and you will get all decide information you want, that's probably so this is a table name. So troubling is that inventory table name. So here is that inventory table name we have defined. We don't need any sort off. Other other other details were interested to pass all this information. See it? So we just replaced with this destiny J song data What we created or tested Jeez, on request body. What? We created a couple off lectures back, and so we're setting up correctly that Jason and everything that's ah syntactical requirement offer dynamodb blind document. So we are setting up all the objects that these are just hard coded in the subsequent electors. We'll see how to get them tiny miccoli. But for the sake of testing purpose, what we are going to do is we are going to just test it. So if we are going to store all this information's instead of this off course, we are going to return Ah, wit on a new promise. Because off course this document client and animal db they work the work like is Ussing on await functionality. So what we are going to create we are going to create a new promise on we'll move all those right functionality inside this promise. So once you, once this call it successful will resolve with the correct state of scored Andi it as if it has failed for any reason. Then we can define what the reasons are on. Let's listen Skopje that request response. What? We have to find a earlier. So if if the request is successful, what we are going to defy status Code 200. And if something goes wrong, we can set State of Schools 400 that is pretty generic AP I development. So we are kind off writing all micro services here using AWS lambda on what we are also saying is that if if there is some error, while writing into Dynamo TV way are defining instead of school as 400. Since we haven't defining what what should come out so that I should be blank because some some some mirror here. And also let's probably pass the exact inner what errors we are having on this occasion. Similarly, if the request is successful, Onda the function visible to write successfully into dynamodb the status code we would be defining us do not want dike walls data on. Since we don't have any other, we can get rid of any editor here. Off course. We I think there is some mirrors. So what? We need to do it. There is a calm, a little bit missing here. Let's just prepare that and not white thing. We're really do use dysfunction. Everything works fine. We have defined promise. We are using document client off Dynamo TV to write into dynamodb table. Let's save all these informations here and trying to test it. Uh, Andi, this is the whole you can You can zoom in a bed. You can get rid off unwanted quote here, Let's go back so we can see what the responses are coming out from this Lambda functions. Let's save it now and uh, just it a bit now the moment we tested. Oh, we see some other coming here on mass, it seems, is it is not authorized to perform. Dynamodb put I tip support. Item is is that is ah, fun in the put items and from sanity What we want to write daytime to dynamodb. So what we are doing out there, it's a missing personality. 15. Updating data into DynamoDB using Lambda: Okay. In the last lecture, uh, we created a lambda function on. We're able to save data dynamo TV. This lecture we're going to update now. The documentation I was talking about and we had a mission be about this put punctual, which creates a new item or replaces an old item. So if the idea same in this case than it's going to replace your role with this new set up the guards now what we're going to do, we're just going to copy this land of function. And we are going to create a function which will up date his data into dynamodb. Let's name it. Update inventory. No, J sometime environment is 8.2. We are going to choose this time. Existing role on this is at inventory. What? We created a couple of lectures back Now, what we are going to do once we have created this initial update, invent away function, we are going to replace with what we had created. Of course, we don't want create and write this old quote every time. Just we need to do one thing. We need to define this lambda environment variable on as you remember to access this dynamo TV table name inventory. Once everything has been set up off course, the Syntex our do update would be a little bit different here. So what we are going to do here? So we need a key. So he's kind off primary key in other rdd miss languages in dynamodb contacts, it is hash key. So it is. So what? So he had that primary idea in this case is I D primary case or what we're going to add is the hash key and how scary it is idea. And, of course later will also get that idea dynamically from our request body. We'll keep all this dynamic, credible, Maribel. Same. Let's let's replace idea with even tidy and everything is going to be seen. Now what we have to do is what we want to update it. So we have to replace our all other valuables, update variables, what we wanted to update with, and we just have to replace with update expression a couple of ways to do it. You can refer a dynamodb documentation with AWS domesticate any point of time what we are going to discuss and you should be doing this method When you want to update your information in dynamodb table, So what? We are going to be points update. Expressen like name is in stark daughter in stock, so has actually defines what credible name we want to replace wheat later on. Andi Poland signifies Dennis us that what should be the value here. So what? What we are going to do here is we're going to define all those variables. What we want to update with all hashes and Poland, as I said, is used to replace with the actual values. A couple of things we have to do now. Once we have updated with update expressions, we have to replace with expression attribute names on expression under need, values, expression, attribute. Names are has names. What we have defined yet on values with the actual values come intimately from the request body. So what we are going to do quickly is we are going to replace and define those all houses with the actual credible names in dynamodb table. So name the actual value off the hash name is no name, which is in the dynamodb table itself on for multiple values on, if you are aware how just on script. Jason get works just separate with comma and define all those dynamo TV attributes with actual actual attribute names in dynamodb table. So what we are going to do we are going to replace with all these available names with actual dynamodb attributes here. And here's the thing we are going to replace rather writing everything on ex special attribute values. As I said earlier, this will be replaced with the actual dynamodb. Not not not dynamodb, but request body variable. So what? We are getting formal request body. So we are going to replace even Dr name as we have done it earlier in the stock with even dot is in stock and total in stock. As uh, you are going to define here, even don't totally stop. Once we have done everything we have all our parents ready and we are just ready to execute . But that's just before this. We're going to update with the update method here so we can get to know we can apply this update in the dynamodb table year. And once we have saved all this information is here on, let's see what has mean what we should be defining 90. We can just copy. And there was all, you know, the values. What we had defined in early lecture on We can just copy best everything. But let's get just come figure here. Everything. So what we're seeing here Update event. It has to be unique. So you can give any even name you are happy with and just define all those request bodies like idea and everything i D name is in the stock on availability this status, uh, and this industry quest body, we can we can just copy this Jason object. Oops, Let's go back and let just copy It is all just on objects objects here so we can define our request body we can copy. This is from dynamodb text view from we can we can you can get it fun. Let's let's define everything here So we can We can configure our request body so we can just define everything here and we can define all the values what we're after to update with Of course I d It needs to be there in the database when, by writing a B, I we can first of all, validate whether that I D isn't dynamodb or not, but for the sake off this lecture, what way? We're not going to worry much about that. That idea tests are not. So. Once we have defined everything in a request morning, let's let's say update it. So we can be assured that what values we are going to update with? No. Once we have defined everything here, let's save this lambda function. And once we have saved this lambda function that's executed and once it has executed successfully, we shouldn't have any editor. And now, if we see this, well, magic happened. Records have been updated now, and that's how you actually update any data in dynamodb. So that's for all this lecture, and I'll see you in the next lecture. 16. Getting data from DynamoDB using Lambda: well, so we have been successfully able to add on a take data and dynamodb. Now, let's let's try to get all these informations from dynamodb off course. We are going to use the same aws sdk. Do you get all those informations? Let's let's review what are different methods to get data from Dynamodb. So get method against a set of attributes for the item with given primary key off course. In this case, what we're after is whole data from dynamodb itself began you squaring But again, we need in that's name and key condition expression to get all those data from dynamodb me on this occasion. What we are going to do is we are going to use the scan method off dynamodb table dynamodb a document to get all those data from dynamodb inventing table. So just a quick recap On what? What What is all methods are supposed to do on feel free to refer this dynamodb sdk documentation. Andi lets you scan in this scan on this occasion. So what we're going to do it returns all the informations from this dynamodb table. So what we are going to use? We are We don't need any patterns in this case because we are not passing any information. But let's create a function a lambda function. Get inventory. Andi escape their runtime 8.1 What we have been using adjusting Rolex use the same rule because it has got access full access to dynamodb table itself. And so we are pretty performed any actions. So let's based everything from the previous function. We don't need problems in this case off course, but we need a table, Liam. So let's let's keep the table name in this case. And since we have defined table him as an environment variable in all other cases, so let's stick with that approach itself. And it is easy to, you know, kind off make your order readable and usable, agile. So what we're gonna do you scan in this case and we're not, uh, you know, passing any expression, condition or condition we can use query method way. Want to quit it on off course. We can use that expression of its can function here, became a skeptic, and we can use expression. Two values the same were used in the case off date. Uh, we can use all those methods here to filter by expression or something. But let's let's. In this case, it's just a great let's configure. We don't have to pass any request body. And just even if you give the request body, it doesn't hurt because you are not going to, you know, congee in those request body and it doesn't matter. That's destined bit and C. We are getting all those informations from dynamodb here, which is pretty cool. So we have added information. We have updated informations. Now we are is reading all those data from our dynamodb table inventory and that that that looks great and that is also kind off. We're just a meeting with data about items so we don't get items added, as it was earlier, but now receive you just get the array off items. And since we are since we have defined data. So that's why data, as in Jason property is coming here, and you can go and verify everything. What you are reading from your dynamodb itself is in Stark. Let's let's change a couple of things and try to read information again. Let's actually apply filter expression here. So what we want to do yet is don't show me all those data. Oh, are all those invent trees which are not in stock? So what we are going to apply here is we're going to filter by is in stop property. So eating stock is a bullion property on. We can pass as a filter expression. So once we once we have running this dynamodb equity, it checks the filter. Expression on it will explode. I would include all those part of those filtered expression itself. In this case, we are going to exclude inventors which are not in stock here. So what we're going to do give me invent lease, which are in stock? If you see, we are going to get only two items this time rather than three. Because I didn't stop to I d want to. Both our in the stock. I'd entry is not in stock. And so we are getting it. It is quite fun so far. I hope you are enjoying this on. I'll see you in the next lecture. 17. Deleting data from DynamoDB using Lambda: the last lecture. We, Richard, all those information from our dynamodb table in this lecture. What we are going to do, we are going to delete on inventory from the Dynamo TV table. So what we are going to do, we are going to create a new delete inventory function which will deal it inventory off course. We are going to keep the same longtime Lambda 8.10 in this case, Andi, for permission, we are going to use the same role that we had created earlier. So once we have created dysfunction, we are going Teoh, just reuse some court that we had previously created. So we don't talk to write it It again and again. Now coming back to this sdk documentation, we have a delete a function which deletes and item from dynamodb. Yes, absolutely. You guessed it right. We need to have a key passed in this battle. So then this sdk or dysfunction is able to define what I d We are interested to delete. It's a little bit patterns changes. Of course, we are using way are going to use the same sort off environment available Compilation convention here Eso what we are going to do we are going to define Yankee is we know is I d here on which will come intimately from the request body itself Dynamodb table year again in woman variable. So let's let's reuse this environment available on active limits inventory off course some other ways. When you when you we are using kind of settle this program, we can have a different kind of reusability to use this environment variable again and again. In this case, we're not much worried about at this point of time. So once we have come to get everything we are using Khalid function here, of course, promise inside it on we are going to configure the delete event. In this case, of course, we are going to pass and i d In that request bodies saw this function can identify which I need which I d we need to dilate. And in this case we have configured I'd equal street off course. We are not worrying about whether this idea is in Dynamodb are not on. You can add this conventionality on top of it. So once this has been executed, you will see this I d husband removed from your dynamodb record snow. So it was quite interesting on so far we have added a trend functionality. How to add an inventory, how to update a inventory, how to read those all inventories and how to defeat on inventory. So far, so good. It is coming Quite interesting. We have created for micro services Andi. In the subsequent lectures, we are going to create a P eyes on how to Kanju in front in the application. I'll see you in the next lecture. 18. What is an API Gateway?: Okay, since couple of last lectures you learned dynamodb how to create micro services using AWS lambda. In real life, you need to call all this my purse services in your front and application or any consumer wants to use these micro services. To use this my purse services, you need to have a dress, for example, a P. I taught your demon dot com eight. Of Louis AP I Gateway allows you to create those end point on. This is a fully managed service that makes it easy for us to create, published, maintain, monitor and secure 80 IES. You can create a sport Ap eyes that act as a front door for application to access. Did a business logic or personality from her back in services. And it'll is a P. I get me hands the heavy lifting for us, including traffic management, autoridades and access control on a P. I wasn't management. So let's examine this in the next lecture 19. How API Gateway works?: Okay, let's examine how AP I get really works closely and briefly talk about this in this lecture . So a B I Gateway acts as a gatekeeper between consumers and consumers can be Web off mobile applications. I would devices so those consumers on a micro services or other AWS services, as this is indicated in this diagram, you can create, publish, maintain, monitor and secure a P I at any scale, and I have been emphasizing through our discourse, we don't have to worry about any infrastructural challenges. AWS does all automatically scale it up and down. As per the traffic. You can cast your frequent AP I calls so they don't go to your services on TV all the time . In fact, you can use a P I get with Kachin. Feature to cash your data don't change often. Also proud would captures details off all the A P I calls that are being made, and those can be analysed further. You can find for the details about those AP A logs, calls and everything what Lambda functions and every detail you can find and really tone in the cloudwatch locks. So let's create couple of endpoints for our inventory application 20. Setting up your first API: Let's dive into a B I gate with on Let's great couple off endpoints for our inventory applications. We have it in a couple off Lambda functions. Couple of lectures back, and what we are going to do now is we are going to create a couple of end points that we can con June in our front and applications do you use a P I get will go to services and look for a P I. Gateway Gateway. This service from AWS and once you have a drive on this bid, you might have different screen. Depends on if you're acquitted, your A P I a year or not. If you haven't credit any AP eyes and you might probably see different screen, just follow the instructions you are on this screen. You'll see a button creed, a P I. And then you can create your new A P I or AP eyes. Using this screen, you can choose to create AP I rest. A P I R Web socket is all our protocol for this learning purpose. We are going to create rescue AP eyes. You have different options that you can choose on, but for the sake of lending. We're going to create new A P s. What we're going to create or define next is our A P I name. So let's say a P I name in our case is inventory services or inventory service For a Sekoff understanding inventory service to a P. I start from inventory services. It's Jews as optimized. It just means that you're a performance will be good now. Created a P I. Once you have two did an A P I. Now, if you have to do an application beforehand with applications that you would know how AP works. But if not that a play works on the resources perspective. So, like user, the action can list off user to meet user created user update user. So let's that's great resource. First, What we are going to define is create, create, create resource, will create an inventory in the application, don't check enable a get records were going to take that later on. Let's create this resource. Once this resource has been created, we just have to define what are the methods so methods can be get put post on for the sake off, understanding what we're going to do is we're going to create a post since it is going to create on inventory in the system. So what? We are going to choose his post to you. Once you have defined method, you have different options here. Lambda Functions Hester T be mocked AWS Services. It's guess what we want to do is we want to create any point on a map with our Lambda functions what we have created earlier. Let's check. Use Lambda Proxy, Integrys and Proxy. It will provide Lambda with request details so your request body and all the perimeters will come through. If you If you don't select the check box, you won't be able to get your request. Body headers and couple of details. Let's Jews waterland a function we are after, in this case at inventory and use default time out. So it is three seconds default time out, period, and it will ask for the permission. So you're a play endpoint can access this land of function, and let's give the permission on this process. Does act emission itself? You don't have to worry about it, because when we have defined method, we have a couple of options method request integrase and request the ability metal request in the in other cases, you might want to authorize your incoming request from your consumer application. Now, for the sake off simplicity, we are not going to create any startup author ideas. And here, So what? We are going to choose this auto radius and none. So we don't want to authorize any incoming request. You have different different options to choose your question, barometer http request headers will not worry about this And what we are going to quit now . Since we have created a resource mapped a little post method, we are going to enable course cross origin resource city. And it allows our incoming request. Do you allow access to this In point on, we are going to allow all the origins here. You can restrict it to a particular domain or particular I'd be you can competent whatever you want to. Let's enable course here. What we are going to do here is we are going to allow all the organs to access our A p I and point what we are going to create. And if any existing course confidence, um, it is going to do all right, it now, once it has created on, applied the course. Now this FBI and point or this particular resource is really to be consumed. No, we have We have to deploy this ap I somewhere so it can creates a choose deploy ap a option and this option will be creating an endpoint for us. Where are fronting duplicates and can reach and access are in point on, then Lambda on dynamodb his name. If it is kind of development stage or production stays, you can actually define it yet. Let's say this is a development, since we're just developing this application at this point of time and we are just developing, let's deploy this. And once you have deployed, AWS is going to give us on end point on endpoints of this endpoint is not going to be changed. And this has got different different options you can never clouded. Watch lots. You can enable metrics and everything. And this is a common ap I end point that our internal application or any fronted application can come June. So we just have to copy this point in our front end up tickets and all for the testing purpose we'll see click around. But we are going to use this end point and this is endpoint. And since we had created a resource called cricket and if you click on to create method, create resources, you will see and this has got a particular create a resource. So once we have created this particular end point, we just have to add it, create resource or create matter in this context. And then this will create an A P I and point for us a full AP endpoint for us that we're going to use in the subsequent lectures. So that's all for this. I'll see you in the next lecture. 21. Setting up remaining APIs: okay. In the last lecture, we could get our first brand new and point, which will get an inventory. Now let's create a couple of other endpoints like updating inventory, getting all the inventories and update and inventory. Of course, let's let's get all the inventories, which are in Dynamodb. Let's name this resource as inventories so we can retrieve all the inventories, which are in Dynamo DB. Of course, we are going to repeat the same sort of steps that we did in the last lecture I'm going to create quickly invented, since it is going to be get get request. So we are going to retrieve all the inventories. So let's choose, get mattered. In this context, off course, we need to define Lambda functions. Also, make sure you check land a proxy integration and use default time out. That doesn't hurt because they'll be pretty quick. Now let's enable proximity reason and let's choose get inventory Lambda Function that we created a couple of lectures back. Let's save this resource. It will ask you for a permission which AWS will do it send from your behalf and let's create. And since we are not going to worry about auto ideas and in this context. So let's get daughter ideas and none. Let's create and enable course in this. So just course we have already just what course is all about. You know, we have created an endpoint, which you will fetch older inventories from dynamodb. Now let's create another resource which will delete on inventory from the dynamodb inventory table, so create a resource called delete. This time we can go after a delete method. But for the sake of simplicity, we are going with post. You can choose an option any suitable option. But let's go with post in this context, less juice proximity reason choose Lambda Function said this again the same process. It's gonna ask you that necessary. Permission. Let's give the permission here. Andi, as we did in the earlier endpoints metal request, we are not going to worry about it. Let's keep it, you know, none. Authorization. We don't want to authorize on. Let's enable course again. We don't have Teoh talk about course again. We had briefly touched course in the last lecture, and we are just going to be the same set up steps here that's now update and inventory so update resource. Let's create the resource. Andi. Let's create a method omitted. We can also go with boot, but let's not worry about put option here. Let's go with post in this case on once that resource has been created, don't presume. Don't forget to check London Props into Grayson Update inventory function Save. It's gonna ask again the permission. Let's do that. And once they're quite permissions, operation have been given. We are going to choose arthritis and none because we're not after any sort of authority is . And at this point of time, enable course again. Seems up steps, nothing hard, nothing tough in this in here. And once we have created all those in points, what we have to do, remember, Yeah, we have to deploy. I you were a B I's And let's use the previous deployments days and deploy all those AP eyes the moment we deploy all the AP eyes off course, the generic or the common endpoint is going to be saying, and you can access all those methods all those AP eyes, respectively, by their own and point used. So create an inventory, create delete inventories and update. So we created all the necessary AP idea we needed to create Andi. Let's test those AP eyes now, using a service called Postman, which is completely free in the next lecture. 22. How to access your APIs and Getting your inventories - Postman: okay, we have come so far. We have created dynamodb table. We have traded Michael services we have created and points and what we are going to do now is we are going to test those end points we just created. In the last lecture, we had created a couple off endpoints. So a couple of endpoints, which can get an inventory in the dynamodb, which can update an inventory which can delete and inventory on which can update on inventory. Let's examine how to be test are in points of postmen is a free too. You got it. Google on you concert this postman product and let's let's download this postman product and this is completely free. You don't have to pay anything, although it comes with a couple of plans and pricing, but we're not going to get all these details on. Also, you have got a postman groom plugging also which you can add on a lot as an extension. Once you have downloaded postman, we can call our endpoints using this free to when a couple off deprecation messages. I'm not worried about much those let's scare all the AP eyes and let's try to test one AP, and let's get all the inventories from the dynamodb table on a couple of options. Couple of messages here you can download New Postman and let us to prison off postman here . But let's let's not worry about much at this point of time. Let's find postman in our application. Andi, let's let's get postman here on. Once the postman is running, we can check all the endpoints. We don't need to have any fronting tour or any conjurer. Postmen is our consumer with this country which is going to come, jean all these and points. So let's copy this endpoints. This is common ap I end point, as we have discussed earlier and let's get all the inventories from the DYNAMODB table at this point of time on the request is get not post and being mindful of that, we don't have to provide any authority, Jason or any header or any request body and see this all data is not coming from your dynamodb table itself. And now we are able to successfully test that this endpoint works. So this is a magic happened here and off course we have our Microsemi says we have dynamodb table data in the dynamodb table. We created those in points which can interact with micro services. And here we get all the data. Let's see an examine couple off more and point in the next lecture. 23. Add an inventory via Postman: okay. In the last lecture, we don't worry, Postman Onda. We were ever to successfully test one of the endpoints retrieving old inventories from dynamodb table successfully. What we are going to do in this lecture, we are going to test create inventory and point so we'll see if we are able to successfully created in majority in dynamodb are not So what we are going to do, we are going to creating inventory off course we are. We can copy the previous endpoint, but also we need to configure the cut and point here in this case create. And also this is a post mated again. So we'll have to change, get with post. We don't have to worry about headers and every other thing. What we require here is we need to pass request about a meter. So request body in this case. And it was all our Jason application data What we want to send. So what? What we can do? You just copy all those Jason objects. What? We created a couple of lectures back and we just successfully with micro services, we are going to ups. We are going to copy all those Jason objects on, and we are not ready to test this end point. No, that's just the same point. I would send hopes. We even induce some issues here. Looks like we end point is not able to receive the barometer's would be air sending across . So what happened? So what happened in this case? Let's let's examine event closely, and this is an opportunity to explore and understand how this works together. So let's output event. And of course, we can directly make changes and we can test through our A p I end point. And what we're going to do is we're going to check on examine event event output. So let's examine mascot re zoos STP method headers. So you can off course, you can get all the indeed tales. And of course, if you remember, we checked Lambda Proxy, and that's why we are able to get all those informations here. So ap gateways passing all those information to Lambda Lambda in return is giving us all the details. What we're after, he had his body on body. If you see body gets all the required input para meters. So what we have to do from the Jason perspective is we have to get all the data from the body property. First on what we are going to do is we are going to create a valuable request body, Let's say and since old is request body is coming as a just on string and we have to parse it back to use it as a Jason object. So let's parse it on. Some suggests on top bars, even Dr Body, because but bodies attribute what we have found. What? We have to do it. We just have to replace event with the request body on. That should be absolutely right. Once we have replaced everything here, let's get it on this event. We don't want now. Andi, we have no really to examine our create and point. Let's go to that would be a bit and see what data we have caught at this moment. So we have got do ideas. So too Rose at this moment on, what we are going to do is we're going to send or just this ap I now, So let's click on send on, See, this time it is successful. It doesn't complain anything about the first body or any missing parameters. And when you first, this time would be We have called this idea in off course. We're not generating this idea. Just hard coding passed it to our request body itself. So this is all about on. I'll see you in the next lecture. 24. Updating, deleting your inventories and a quick recap: in the last lecture we created on inventory using pretty on point, we ran into issues on we fixed it on. What we are going to do is we are going to use the request of party in all other land of functions. Let's copy a request body from ad inventory function and let's replace this with all the events defined in on the Lambda functions. Let's go to delete inventor first and let's replace even to it request body What we are getting as a request bodies a request. Polly, just replace request money here on We should be all right. Let's copied here. And let's place this in update inventor function we have here just replace this even with two requesting Bondi and also the other para meters and attributes what we want to update. Wait, Onda. We are now all set. We have made all the changes get inventory doesn't require any changes because we're not accepting any request body. So that is absolutely right. Now what we are going to do is we are going to update on inventory in the database. So let's replace a peon point is going to be same, but you're going to replace with a date. Let's a day to the name so we can be sure what we are going to change with USB Most one year idea. Three. Let's let's change. I have updated on update and I was in the request. Is not successful in one school first. Dynamodb. We now see that i d three role. It has been successfully updated. Now let's let's try to delete an inventory and see if we are able to do that to lead on. We don't need all of the details. We just need idea to delete an inventory. Uh, Andi year old inventory is here now. It's just this functionality. The request. It's successful albums we depress here. It's gone so ability and found his autos working successfully, and we have tested it. Believe this. Fine. Let's create another inventory. Andi Also let's trying to get all the inventories and then we can about this lecture. So now it's created inventory in the database, and we have to credit successfully wants me to press. Dynamodb will see this in Dynamodb. Now let's go to Let's Updated is in stock flag with false from true on. We think that this is not in stock at this moment. And what we are going to do is we are going to update with rock solid USB mouse. And let's send this request once we go into dynamodb will see is in stock should be false. And here, indeed we see in isn't stock flag is false. And that inventory is currently out off stock again. What we want to do is to so that inventories in stock. Now, what we're going to do, we are going to get all the inventory. So we are sure that what other inventories are in the database and whatever we see in the database, we should be able to see everything here. So in this lecture, what we did, we tested all the ends points successfully, even ready to create an inventory update and inventory, delete and inventory and get all the inventory on the Dynamo TV. We have come so far. Very great job, Andi, this is all about all these scores. But as a bonus lecture, we're going to con Jean all these endpoints in an angler seven app in the next lecture 25. Inventoria app introduction: I am so happy for you to come so far. You learned several s development using Aws, Dynamodb, aws, lambda and Louis AP, I gate. You created micro services using AWS lambda that manage inventories. Andi, you tested those all endpoints using a free tool called Postman. In this bonus lecture, we are going to consume all those end points you have created so far in Victoria is an inventory management application built on angular seven. I don't you to be expert in angler seven application and grating, angry seven application. It could be any sort off front and application you choose to integrate with. Let's set up the sample application in the next lecture on. What you need to have is you need to have access to all those end points. What you have created so far, that's so far for this lecture. And I'll see you in the next lecture where we are going to set up inventory app. 26. Inventoria app setup and configuring your endpoints: Okay, let's set up our inventory. A app. So to jungle inventory a at or do you have to go to get have project I'm going to provide. This link on this is publicly accessible. It doesn't require a user name a passport to clone it. So what we are going to do, we are going to copy, uh and point or the u N from where to clone and just clone it. And since it doesn't require you to have any sort of user name and password and that's now we have downloaded inventory, a app and for the for this lecture, what we are going to do is we are going to use you cold. Well, you studio coat on. That's a free too. On a pretty good Teoh develop angler seven or any annual application itself. Off course you can build a lot off stack using visual studio, but we are going to focus with angler on under seven at this point of time. So when you open this project in visual studio good or any leader you choose, go to your Contador ts find that typescript Fine. And if you see we have defined couple of edibles here on those a p I endpoints we are going to set up here. So do you get all those inventors? We just have to copy the end point what we were using. So similarly, we'll copy everything all the endpoints, what you have created so far throughout discourse on. And we are going to configure all those and points in this angler seven up update lets up. Let's set up update you are l Let's set up delete inventory. You are OK, so delete. And let's set up the late here. Now what do you have to do? Is and to run any angler seven. Since it uses no Jace in the background and Lucy allies of what? We're going to use this NPM start, you can go and check back. It's dark, Jason, If you are familiar with Norges how it works. If not, you just have to fire and b m start on very mind. You can use any funding application. Okay, So what we are getting here is but not find model. So what we have to do is we have to install models, all the packages first of what we are going to do we are going to install all the required packages. So what we are going to do is we have to go to inventory a up on just used npm install. Yeah, but because since it requires all the packages and since it could not find any monte or old any necessary models, what we have to do is NPM install so it can download all the necessary package to run this up. Andi, it's going to take, uh, a couple of minutes, but and adult depends on your Internet bandwidth and everything. But once say you have downloaded all the required package packages that will be telling loaded in a couple of minutes or second depends on your bandwidth. As I said, we have downloaded all the models. Now we are going to repeat the same. We are going to use MPM stop to run the angular seven up. You see, we are using Angler seven in this in this contact in this application, couple of exciting features I hate with angular eight, which we had expecting in a couple of weeks time, and this is what it is doing. It is just resisting application and guns. It actually gives you in the local host on the boat number. And if you call here Well, you see, all these in commissions are coming from the DYNAMODB Lambda and FBI. Gateway sold dysfunction duplicates. And this is calling and those end points And those in points in turn, calling Lambda and Dynamodb subsequently. And that's how we are getting all these applications running. 27. CORS and adding headers: a little bit about course since we are now using all those end points. Now, if you try to run your and your seven up except local host like we're using local I p address to run this application, it wouldn't load. Let's investigated using developer tool and what's what's happening here and we see the request access XML have to tip your request, which is calling. All those end points are getting blocked by course policy. So it says no access control allow origin headed is present on the request resource. So since earlier we were running the app using local host, so it was fine. Now we are not using local host anymore, but a local i p address to run the app. So let's let's examine Lambda function on what? What is missing? Secrecy Arlanda. We haven't defined any course ponsi here, So what you have to do is you have to add across origin policy here so before the Sekoff convenience and you can actually use a lot off access control, allow origin and course policy. In this context, what we are going to do is allow all the origins the local host, any i p address or any user can access our endpoint, you can choose to block your access by domain name or right Be address so specific domain name or specific. I P address can only use your endpoints, and we can configure that. But for the simplicity purpose, we are going to configure and allow all the origins. So star now, once we observed is Lambda Function. We are going to run the application, and once we're on the up again, we see that error has gone, and now we're able to load and use our endpoint successfully. It's a little bit, and if you are having the same problem, you need to update all your land of functions with course policy now a little bit about cross origin. Resource setting. So, of course, is just It's a kind of mechanism where you allow your incoming requests so it can be your domain, and it can be your astri bucket. It it can be, you know, you're any any other front and application. So it just runs on request response model off. Just a couple of other jargon spree flight request be flight response. But those end points actually allow on the base off the course policy on. If you haven't culture course started out, you might run into this course issue. So in the future, just remember this. It's ah, it's a big topic in itself, but let's let's not worry about this at this point of time. 28. Local serverless development and test using Serverless framework - an intro: okay in the real world, reborn to develop and test locally using No, Jay's not met court by time or your joints of back in language should be supported by integrates land. We are going to discuss about two You popular several lists. Fragments suddenly start calm and end of Louis. Sam, you develop your application the normal way, but they are ready to be deployed in the cloud without you own any infrastructure and you can create your C I city pipeline, and you can set up everything as you do in the normal, softer developing process. You can have your own build servers, three I city pipeline and everything. And as we have been discussing, your stack is ready to be deployed in the cloud on you. Don't own any infrastructure off course. You need to have some sort of understanding of why you're melon, but these are just pretty simple to understand. You can create your AP eyes. It is. It is just kind of confidence and stuff defined in the UAE. Evil fire on you can set up your application. You can you can create your application locally. You can test your application locally. You can write unit tests, you can write integration test and you can do everything locally. In fact, you can install dynamodb locally. There is a version and AWS supports local dynamodb application and execution from time as well so you can download for the local development. You can also use AWS Sam on both of frameworks are our same in terms off because they actually provide conflagration on the serverless if development and they're pretty handy tools. Andi, I would encourage you to more then about those all civilised friend work as you can write everything using AWS lambda. But that won't be fun if multiple developers are working in a team. If you're working alone, it might work. But sometimes at at some point of time you want to set up, see i city pipeline and you want to automate everything from testing unit tests and an integrated tests perspective. But that's all about I'm going to give you all those links on. You can choose to study in your free time 29. Course wrap up: well done and I'm super excited. You have finished this course. It is just about the course. Wrap up what you have learned so far. In this course, we touched briefly about cloud computing and several its soulless. In general, we you learned how to use several lists. Databases dynamo db Ueland helped agreed Micro services using AWS lambda You also learned how to create endpoints Using AWS ap I gateway You also learned how to test your a p I using a free to called postman as a bonus lecture. We also so how to integrate all those in points in an angler seven app And I think it is you to go and try those end points in your any front end application you want to choose. We also touched a bit about several is development using several It's frameworks Onda. We saw solace on AWS sam and how they are a great fit for local civilised development. So your normal software development cycle would be sent you In addition, you can create your own see, i city pipeline build servers and everything and you can test your application locally using local dynamodb as well get us benefit is your application is ready to be shipped on. Deployed in the cloud directly from your local environment. I'm super excited. You have finished the scores, but keep practicing what you have learned. 30. What next: I'm super excited. You have finished this course and you are ready to build Amazing several ISS province. For your information, you can build everything civilised so you can choose dynamodb For that of this, you can create my processes Using AWS lambda, you can create your endpoints using AWS a p I on you can hold your static website. It could be angler Jay's or fronted application on you can host using at AWS Stu, I have provided you all the links in this lecture. Please feel free to download and practice as much as you can. Thanks again for joining this course and I wish you all the best.