Building Serverless Apps in AWS | Qasim Shah | Skillshare

Building Serverless Apps in AWS

Qasim Shah, Digitization and marketing expert

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
15 Lessons (1h 9m)
    • 1. Introduction

      1:36
    • 2. What is Serverless

      7:53
    • 3. Serverless App Repository

      2:54
    • 4. Chatbot architecture

      3:18
    • 5. Creating slack chatbot

      3:35
    • 6. Launching image moderation bot in AWS

      7:09
    • 7. Serverless Web App architecture

      2:39
    • 8. Hosting a static website

      6:13
    • 9. User management

      5:21
    • 10. Creating the serverless backend

      7:30
    • 11. RESTful APIs creation

      6:53
    • 12. Image processing architecture

      2:43
    • 13. Creating Recoknition collection and Backend

      3:05
    • 14. Creating a Step Function

      3:33
    • 15. Modifying and testing the step functions

      4:32

About This Class

Serverless enables you to build modern applications with increased agility and lower total cost of ownership. Building serverless applications means that your developers can focus on their core product instead of worrying about managing and operating servers or runtimes, either in the cloud or on-premises. This reduced overhead lets developers reclaim time and energy that can be spent on developing great products which scale and that are reliable.

This course is designed to give you a hands-on overview about the deploying serverless architecture in AWS utilizing their vast repository.

Course Description

Welcome to Building Serverless Architecture - A one of its kind course! It is not only a comprehensive course, you are will not find a course similar to this. 

In this course, you'll learn and practice:

  1. Understanding of what is serverless apps

  2. Learn how to deploy a chatbot in a serverless architecture

  3. Learn how to integrate slack bots with AWS

  4. Deploy a live web application in AWS

  5. Use various services such as Cognito, Lambda, S3, DynamoDB, APIs ...

  6. See Serverless in action, and much more....  

In this course, you will also get complete resources, and code where applicable with this course! We've built this course with our Team ClayDesk of industry recognized developers and consultants to bring you the best of everything!

So, if you would like to:

- Gain an understanding of deploying serverless architecture, this course is for you

- Gain marketable skills as an IT expert and professional, this course is for you

- This course is not designed for intermediate or advanced level students

...this Building Serverless Apps is exactly what you need, and more. (You’ll even get a certification of completion)

What out students say...

See what our students say “It is such a comprehensive course that I don’t need to take any other course but this one to learn all of Machine Learning processes and important terminology along with demos - Absolutely worth it” - Chavez

“This is such an awesome course. I loved every bit of it – Wonderful learning experience!”  Jill Neumann.

Join thousands of other students and share valuable experience

Why take this course?

As a senior Project Manager & Web developer, managing and deploying enterprise level IT projects, along with a Microsoft Certified Systems Engineer & Trainer, my experience with Machine Learning projects has been phenomenally great! I am excited to share my knowledge and transfer skills to my students. 

Enroll now in Building Serverless Apps today and revolutionize your learning. Stay at the cutting edge of enterprise cloud computing — and enjoy bigger, brighter opportunities.

See you in class!

Qasim & Team ClayDesk

Transcripts

1. Introduction: going serverless enables you to build modern applications with increased agility and lower total cost of ownership. Building serverless applications means that your developers can focus their core product instead of worrying about managing and operating servers or run times either in the cloud or on Prem. This reduced over add lets developers reclaimed time and energy that could be spent on developing great products. Which scale and that are reliable. Hi, everybody. Welcome to building serverless APS in eight of us. Mining is Qassam, Shara and I'm the instructor for this course As an enterprise architect, I've been helping organizations realize the benefits of the cloud for several years, now has an AWS certified professional. My main focus has been with AWS Technologies. Now this course is designed for students who have a basic understanding off the AWS services such as recognition lambda as three and so on. But nor if you do not have that knowledge, I will walk you through each one of the steps one by one. By the end of this course, students will have a good understanding off the service architecture in AWS, along with being able to deploy several serverless applications. Let me walk you through the course agenda. We're gonna begin off by discussing the basics of service technology and then move on to building three separate applications. We're gonna build in image moderation, chatbots. We're gonna build a web application and then finally, an imaging processing back. And so if you're looking the build service architecture, this is the perfect course for you to get started. So what you waiting for in rural now and start learning? 2. What is Serverless: everybody Welcome to his lesson. I'm looking at What do we mean when we say If something is serverless, let's look at award is serverless so conventionally Applications War written and run in servers, which were allocated fixed resource is, um, such as hard work. So what happened was is there were a lot of problems with sudden spikes of traffic. A little let's say the demand increased and servers were not available. Toe handle the number someone of data. And with the ever growing globalization, when somebody is launching an online website, you might see great spikes and data so that in that tradition sense there were issues in terms of handling the hardware or Hogan that harder handle all of that spikes in traffic, both up and down. So to address that, that's where came the platform of the service, or past, in which basically, providers offered scaling. But it had his drawbacks compared to serverless architecture. So get, um, Serverless in a typical stack. Most of the time, the CPU remains idle because the server is busy with networking and and put up or requests . So these drawbacks are basically what's handled by serverless architecture. When I serverless. I certainly do not mean that there are no service involved. Serverless dozen While servers Onley the implementation and management is different, So traditional servers or compute instances, had fixed resource is that run all the time and need administrators to manage them and a serverless architecture. On the other hand, it's basically run in compute instances that are event driven. So what basically means that each event or request to the server a state is created, and after the request to serve the state, it automatically destroyed. So unlike typical servers, serverless provisions are completely managed by the provider, using automated systems that eliminate the need for server administrators. And in the architecture you have shortly functions that are invoked upon each request. And the provider, for example, would build the client for each individual function or logic. That's where basically the term F A s or function as a service came in so fast. Provisions allow running cold without the need to manage the server system and server applications, and you will see that when you go through the labs later on in this course. So, basically, what's the difference between third party manage servers and fast my boat seemed the same as you don't need to manage the server system in either of them. So the fundamental differences that INF as you also do not need to manage server applications, which was not possible in typical systems. So let's take an example. Let's say you have a social media application. So as users interact the site, the application collects behavioral data and process them in a dedicated server toe toe, learn more about the users and provide relevant data. Now the service Onley dedicated to machine, learn those behavior patterns. In the case of fast, it is replaced with functions that do not require that physical server to run and can be executed, among other functions in a shared pool of resource is, and there's also another advantage to this architecture. You, for example, do not need to cold your app to any particular frame or library. Any language can be used, and what's even before interesting is that fast functions written in different languages can interact with each other so multiple functions can be connected and chained together to implement reusable and compose herbal systems. So now all of us might be familiar with with I s e a s and p A s. So now we're gonna add in f A s or fast. So just to our briefly give you your view. So infrastructure as a service or I, as the basic, provides only the base infrastructure, the virtual machine, the stores defined network storage attached, and users have to configure and manage platform and environment. Deploy applications on it because you guys can see And the blue is what's handled by the organizations, that is eight of us and the rest is handled by the organization's themselves and one that you do not see on here is called. It also software as a service or cess. And you know, sometimes people also call it on demand software, which is typically access by users using thin client. Why a Web browser? So, for example, Microsoft Office 3 65 is considered a cess platform or, if you're using Gmail is also a SAS platform. Then you have passed, which is platform as a service that he provides a platform along and users to develop, run and manage applications without building and maintaining infrastructure. Everything. All of the infrastructure, the containers, the OS, the harder is all handled by third party organisations such as AWS. Now what I also have on theirs. Container of the service it's being used more and more nowadays is basically a form of container based virtual ization in which container engines, orchestration and the underlying compute resources are delivered to users as a service. So, for example, in AWS, you have the elastic compute services, or PCs, or you have in a jury of a CS and Google also has your container jin the G k e. So, after all of that is when we come to the last step, which is fast function at the service and that, like I mentioned, it, provides a platform along customers or users to develop, run and manage application. Funks now is without having to do with the complexity off building and maintaining the entire infrastructure. So the only thing you're dealing with our functions and everything else is handled by the third party service providers such as AWS. So let's look at both advantages and disadvantages off using fast, so some of the advantages, for example, you have fewer developer logistics server infrastructure management is handled by someone else, and you have more time focused on writing cold or app specific logic, which means hired developer velocity, and it's also inherently scalable. So rather than Skilling, your entire application in scale, your functions automatically and independently with usage and very important, especially for management, you never pay for idle resource is it also has built in availability and fault. Tolerance and business logic is necessarily modular and conform to minimal shape herbal unit sizes. But it's not all on the up side. There are also some disadvantages of using this. For example, you have decreased transparency, so someone else's managing infrastructures. It can be tough to understand the entire system. It's also potentially tough to debug on their tools that allow remote debugging, and some services provide a mirrored local development environment. But there's still a need for improved touring because it it is a very, very new service. Then there's also auto scaling or function cells often mean auto scaling of costs on again . They can also increase your expenses and then you also had. Now we'll have a ton off functions deployed, and it can be very tough to keep track of them. This comes down to need for better tooling and developmental diagnostics and visualization so it can be managed. But again, you need to plan for it accordingly. And lastly, solutions for cash in resources between stately requests such as DB connections and recycling network requests are still pending means meaning they're still in the development stage for this service. So fast really isn't a solve all problem kind of service. It is still fairly new, but the advantage is that it offers far outweigh the disadvantages for some business cases , not for all. 3. Serverless App Repository: Hi, everybody. And welcome to this lesson I'm looking at the Serverless Hap infrastructure or service app architecture that is utilised by and provided by AWS. So the serverless app, repository, or architecture is basically a manage repository for a host off server less applications. So it basically enables you to easily assemble and deploy architectures and very, very innovative ways that you, as we will see when we deploy our application. So using this repository, we basically don't need Teoh clone build package or even publish source code to AWS before deploying it. Weaken, basically use some of the pre built applications from the repository and the architecture, which greatly helps us to reduce duplicated work. And what we can do is utilize best practices. For example, if somebody knew joins organization, we could have them use that same repository to deploy applications at much greater scale. So basically, each application is packaged in a server less application model, or sometimes you guys also here, sam template that defines the AWS for resources that are going to be used. So basically, if you guys are familiar with claw information, that concept is exactly the same. So you guys can see, this is basically how the serverless app repositories going toe work force is going to find a deploy application for common use cases, and we'll see in the upcoming lab. When we deploy the image recognition Chatbots will see ah, host of applications that are already provided by AWS for us to use and customized to our own needs. We can search and discover host of applications in the repository. We can configure them, weaken, set each environment, variables, parameters and do a lot more before I could deport the app and then finally deploy and manage the app in our AWS account. So the great thing about this is you can use some of the templates that that are provided about eight of us and configure them to your need so you don't need to start from scratch. Use one of the repositories that are already provided by AWS and you guys. You guys will see that our host of them that are provided by AWS and then we can configure them and customize them to our own organizational needs rather than starting from scratch. This has basically done more than half of the work for us already So for a lot of those small or medium sized organizations that do not have the manpower or the resource is to develop applications or develop scaled applications themselves can use the resources that are provided by AWS, too. Get them up to speed to what some of the larger organizations are doing that do have the resources to develop applications and house. That's essentially how the service, app repository works. And again, you guys will see how and what different applications are available in the upcoming lap. 4. Chatbot architecture: everybody. And welcome to this lesson. I'm looking at the different architecture that makes up the image moderation chatbots. So the image moderator chatbots is basically going to be a server less architecture, and in that we're going to use Amazon recognitions. Image, moderation, Deep learning feature. ATO automatically remove images containing explicit or suggestive information. So, for example, what we'll do in one of our labs. We're going to upload a couple of images and see how the chat, but is willing to remove an explicit image as compared to a regular image. So let's take a look at the architecture that is used to develop this chatbots so you can see in the first step users going to do is going to post a message containing an image to the chat application, and in this course, we're going to be using slack. But you can use any chat application that you want. So after that first interaction, the chat application is going to post the event to an Amazon AP a gateway, a p I for the chatbots. So after that posted on the chat but is going to validate the event on this event is what triggered the AWS Lambda functions that downloads the image into an S three bucket after the images downloaded into eight of us. What Amazon recognition is going to do is when you use his image recognition feature that checks the image for suggestive or explicit content after checks that the chat ape, the chat app, a P I is going to delete an image containing explicit or suggestive content from the chat channel. And lastly, the chatbots is going to use the chat at a P I to post a message to the chat channel detail ing the deletion off the image. Essentially, that's the information flow that's going to work through our chatbots. When the user posts anything or uploads anything that contains explicit information, it's going to go through this process initially going to the Amazon AP Gateway. Then the Lambda functions going to trigger the recognition, which is going to run its course as deep learning information on the image and then provide the information back to the user. Either let them upload the image or automatic automatically delete the image, and then let the user know that the image has been deleted because it contains explicit information and we'll see all of this in the demonstration when we actually put this in, use and develop the chap, the image recognition chatbots, and you'll see how that works in detail Now, just as a note in this course, we're using an image recognition to check for explicit images, but you can use Amazon recognition to check any information and an image. For example, you can check for celebrities you can check for facial features, so there's a whole set of information that you can developed in Amazon recognition to check for information. So in this case, it's simply checking if the image contains explicit information. But if you want to put this in implementation in your network or in your organization, you can develop any kind of deep learning formula in recognition to recognize any types off images and served that admission back to the user through the chat pot 5. Creating slack chatbot: everybody. And welcome to this tutorial on creating our first slack chatbots. So I'm not gonna get into too much details about what it's like and how to configure one that would be a bit outside of the scope of this course. But what I am going to go through is how we can create a basic chatbots and slack and how we can get that connected with our AWS machine so we can do that. Image recognition through AWS is recognition and are Lambda functions at the same time. So you guys, since he I have already created an account and select in my dashboard, what I'm going to go to do is create a slack app. No, this basic information that we need to provide. I'm going to give my happen name called Costume Chatbots, and we also need to assign it to a specific workspace. Since I really have one, I'm going to go ahead and select that, and I'm going to go ahead after that and click on create app. Now. If you don't have a workspace, you will need to create one before your app is created. Okay, so that's see, it's it's it's a fairly simple and straightforward process. So after we go ahead and creator app, we can configure many changes and many options within this lack app information. But what we need to do for our chat about is we need to grab some information from this and put it into our AWS console so they can communicate with each other. So what wonders in the basic information if we scroll on down, the first thing that we want to note down which will be put in an AWS is our verification talking. I'm just going to copy the verification token and paste it in my notes so I can come back to it later. When we're configuring are eight of us system Next thing we're going to need after the access token is in the off and permissions that when we go where someone we go and click on often permissions we need to scroll on down and into scopes. Now, here, when it at some informations eso a This a pee I app can communicate properly with the AWS, chatbots and AWS functions. So what I'm going to do, I'm going to add a few app permissions in terms of the channels that will allow it to communicate with AWS and act as a chat, but that will recognize and limit and the type of images that can be uploaded into the system. So these are the four mean scopes that I want to make sure that we get added in into this app. After I do that, I'm going to save the changes. As you can see, it's successfully, it successfully saved. And once everything is saved and configured, we want to click on install app, toe workspace, and what this is going to do is going to install this application in my workspace that I have specified and I do is you need to make sure that you authorize this app so it can act at in a public channel. Otherwise it will stay private but office. Since we want to have users interact with this application, we want to make sure that we make it public. After we do that, we need to also copy the off access token has your decency. I have this copy and pasted in the notes. So once we do that, that's the That's everything that we need to do in order to create the slack up in the next lesson will look at how we can use this information and get our AWS system set up and configured. 6. Launching image moderation bot in AWS: everybody and welcome to this demonstration on launching our and creating our first image. Moderation. Chapa. Now we've already created the application slack. What want to do is create the corresponding chatbots and the image recognition within eight of us. So I'm going to go ahead and navigate to the server less application repository. And here is where we can find a host off pre configured application repositories that have been created for us by AWS. Now I were holly suggest you guys go through all the different options that are available because we are able to minimize and reduce our time significantly by using some of these templates and just tweaking them a bit and modifying them to match our needs. Based on our business case, what I want to do is search for chatbots, and here we can see we have an option for a image moderation chat. But we also have a hello world selects and a chime bought with what's new at eight of us. But for the purposes of this course, we want to go ahead and choose the image moderation, chat pat. After I do that, it takes me to a new screen where It gives me all of the information regarding this Emily image. Moderation Chatbots on more double. Do you guys see on the top? Right there is VSE on the top, right? There is a deploy button and the deploy button is going to deploy 30 different deployments within eight of us. When I click on the deploy, it will take me into my AWS council. I was on The first thing I want to do is make sure that I sign into my AWS account where this these deployments are going to launch I once I'm logged in here is where we can see all off the different information regarding this deployment that has been pre configured for us by AWS. Now, if we expand template, we can see all of the different information regarding the specific details on what is happening in AWS when we launch this serverless app repository. So this is basically and so this is basically in Jason format and you can go through it, give it details out all of the different services that will be created within AWS in terms of image recognition, the s three buckets and someone So you are also able to create everything manually, but again that will take a considerable amount of time. So by using this template, we can automate a lot of that process and cut back on a lot of time spent. No. On the right hand side, you guys can see some application settings now. This is where we're going to grab our off code and and information that we got from arts like AP and just paste that in there for the verification token and the access talking. That's what is very important when you create a slap slack apt that you note the's dark. Want tohave that I'm gonna go ahead and click on Deploy. It might take a few minutes, depending on how fast your connection is and how fast it's working. But it might take a couple of minutes for everything to be launch, I guess, and see that it gives you imagine saying that the application is being deployed and it gives a real time monitor off what is being deployed and at what time and after everything is deployed, you can see that everything is created and completed in terms of all of the deployments within eight of us And if you click on the view claw information stack here is where we can view all of the different information regarding the clot formation stack that was just deployed through the serverless APP repository that created all of these services. Within eight of you ask because concede that the stack status has been created. Everything is completed. The outputs. Now, this is the important one that we need to keep a track of. It gives a request. You, Earl, that will need to know down and configure in our slack apt that we created in the previous tutorial. So I'm going to go ahead and a note down this request. You are also along with the other information that I know it done before I want to have the request. You were all I'm going to navigate back into the slack a p I, which I was grating before. I'm gonna go ahead and go into event subscriptions Now, this is where we can add the U. R l that was created by AWS. I'm going to enable the events and in the request you are Oh, I'm just going to copy and paste the girl that was created by the clot formation template in eight of us, an adjacency that the girl has been verified to. Everything that should be a good to go in terms off the linkage. Know anything that I want to go after we do. The girl is create some works based events so the messages can be read and posted within this lack happ through the check about service and through eight of us. So once I do that, I'm gonna go ahead and click on save Changes. So let's test out the chat about first thing I'm going to do. I'm going to see what happens when I upload a a regular image. So let's say if I try to upload eight profile pic off myself with this chat. But I'm just going to type in a random message and upload so you guys can see that the image has been uploaded along with the message that I typed up. Let's see what happens when I try to upload an explicit image, because, according to our cloth for mission template, that image should automatically deleted by the at because images of explicit let's see if our toe upload a suggestive image onto this app on see what happened. So if I click on upload, it will upload the image for a second and then right away it will take it off and we'll give you a messaging. The file has been removed due to explicit or suggestive contents. You guys concede that this application and the image recognition I'm attract about that we have created in AWS are working properly and as they should be working. So it's as simple as that in terms off creating and launching applications or creating launching serverless applications within AWS by utilizing the serverless app repository. And as you saw, there are a host off different APS and different configurations that are available for us to use. I've simply used one and disconnected with a slack Bart. This congee also connected in Facebook or any other service that is available out there, since it's all done through AP eyes. So again, like I suggested, let's go through the APP repository off all of the different configurations that are available for you to use and customize, and they can be customized as much as possible because if you noticed in the clot formation stacks, all of all of the different services that are provisioned automatically, we can go back into it and modify them to match our own business needs. 7. Serverless Web App architecture: everybody and welcome to this section on building our first serverless Web application. So let's take a look at what will actually be doing in the subsequent demonstrations. So we're going to deploy a simple Web application that enables users to request something called a unicorn from the wild ride sleet. Now the credit goes the wild rights team. They're the ones that actually developed the the back end, the static website and the JavaScript files that enables us to do that. So basically, the application will present users with an HTML based user interface for indicating the location where they would like to be picked up. And it will give you the interface on the back and with the rest ful AP I Web service to submit the request and dispatch a nearby unicorn. So it is actually basically a uber uber application that you're that war we are going to be building obviously on a very low scale. So the architecture that we're gonna use is we're gonna be using services in. It'll be a such a Z lambda the a P a gateway, the S three buckets, the dynamodb and the cognito. So the yesterday is going is the one that's going to be hosting our files. So that's gonna host our static websites such as the CSS, JavaScript and the HTML Files. Now all the JavaScript that's going to be executed in the browser. It's going to send and receive data from the A P I that's going to be built using the Lambda and the A P a gateway. Additionally, the Amazon Cognito is going to provide user management and authentication. So basically, when the users log in or when they go to the upset, we will require them to log in, provide some basic information and get that verified. And once that is verified, we're going to give the users a token which will make them authorized to request rights. Because obviously we want to make sure that we know obviously want to make sure that we know who was requesting the rides we don't want and the anonymous users requesting rides or requesting resource is we want to make sure that the users on the website are known and authenticated. So essentially, that's what we are going to be building in this in the subsequent lessons on, just keep in mind that he since the website files have already been created, you are able to modify them as you please, depending on the business case or depending on what you want to do. But the underlying process will stay the same in terms off what you need to do in order to get this operational as a server. Less Web application. Without further ado, let's get started and create our on going to our next step, which is creating our static Web hosting site. 8. Hosting a static website: Hi, everybody. And welcome to this lesson on creating your first aesthetic website in Amazon Aws. So what we're going to go through in this lesson is I'm going to create a static website using an s three bucket and then we'll upload some content into the as three bucket and then tested out to see if that static website is actually working. So the first thing I'm going to do is I'm going to log into the eight of US Council after I logged with the AWS Council. I need to navigate to my as three buckets. Now you guys can see our It's in the recently visited because I went to it before. But you can also search for it here. If you type in as three, it will take you through the same s three dashboard. So here is my after your best dashboard. Yes, and see some buckets are already created, so I'm going to go ahead and create a new bucket, specifically the hostess static website. So first thing I want to do is give the bucket of name and keep in mind that the bucket name needs to be DNs compliant and it needs to be unique across the entire AWS ecosystem since it is Deanna's compliant. So a lot of times you will need to come up with unique names because most the time, the most common names are already used up because you guys might know there are a a lot of users in AWS, so I'm going to give my website a name. Here's where I can select which region I want to host a website and I always usually stick with Northern Virginia because that is one of the main regions and most of the services, even the new services, are usually available here first. But depending on if you are going to be using it in a production environment where you're located, you'd want to select the relevant region. For now, a couple of options. After here, we can either directly create the bucket, or we can click on next to configure some additional options. I'm gonna click out next just to show you guys the different options that are available in the S three buckets. Now, all of these options we are also able to configure after the creation of the S three bucket . But you can also create them while creating it. So depends on if you already know what you will be using the bucket four. If you know the options, you want us like you could do that right here rather than going back and doing it again. So one of the options is version ing. If this helps us keep track off what's going on in the bucket if something is deleted if something is added, it's a good way to keep a trail off what's going on? So I'm going to leave all of these as default for right now, but just want to show you guys the options that are available while creating the S three bucket and Claude watches. If you want to monitor the bucket, the access and the activity that's going on in the bucket in terms of the objects created and deleted and access, you can also do that here. So I'm gonna click on next. Now, by default, everything in a nasty bucket is private meeting. Nobody from the outside is able to get access to it now. Obviously, if we want to host a website, whether static or dynamic, we want to make sure that we allow access to people from the outside world so they can enable so they can. So they are able to view the website. So you want to make sure that we uncheck these boxes After I do that, I'm not click on next and here's A or view All of all the options that I have selected and I'm going to go ahead and create my bucket and there we have it. As you guys can see, the bucket is created called costume static website. Next thing I want to do, I want to upload the content. So I'm going to upload the website the static pages off the website into this s three bucket. So there we go. I have my static website uploaded in my s three bucket. As you guys can see, all the files are within this folder called Website. So what I want to do now is I want to go and check my permissions from the corn, the permissions tab and just want to verify that the public will have access all of these air still unchecked. Next thing I want to do is click on the bucket policy because what I want to do is I want to allow everybody or I want to allow anonymous people toe have read only access to this website or to this folder. So in order to do that, I'm to create a simple bucket policy. And I'm going to do that through Ah J. Saad Bucket, policy editor. So it's best to see from this j stop this basic Jason will allow anonymous people get object access to our bucket. So that's only allow them to read the objects that it won't allow them to write or delete any object from this s three bucket. Now that you guys can see if I click on the index dot html file, there is a valid object. You are up. And since we've made this public, people across the current will be able to access the index dot html from the default articular all that Italy has provides when you put anything in s three bucket. But also we want people to access our website through a domain name or through doing index dot html. So we want to do is go ahead and set up static web hosting for Rs three bucket from the go ahead and go back to the S three walk bucket, and I'm going to click on properties. And these are all of the options. If you remember, when we were creating the bucket we were able to define and again like I had mentioned, you can also define them while you're here. So we want to do is we want to click on static web hosting and want to use his bucket to host a static website. And the index document is index dot html. So before I click on save, you want to make sure that we know down this end point you or else I'm just going to copy it into my clipboard. After I do that, I'm going to click on safe and there we go. So now we have this bucket is hosting a static website, so I'm going to just verify that. And there we go because God concede that the index dot html pages appearance. So that means we have configured our static website in the S three bucket properly 9. User management: Hi, everybody. And welcome to this lesson on setting up our user accounts and user management for our static website. So what we're going to set up is whenever somebody visits the website, we're gonna have them red strip. So they're gonna provide a basic email address and that's going to be sent to Amazon cognito user pool. Amazon cognito was going to send a verification talking to their email, which they will need to verify. And I'm sure if you guys have registered on somewhere obsessed, they do send a verification token which you have to verify in order to be able to log into the website. That's essentially what we will be setting up here through Amazon cognito. So when they sign in with their credentials, a JavaScript function will then communicate with cognito, which authenticates using a secure or, um or password protocol, or SRP, and then receives back a set of Jason Webb token. And we're gonna use those tokens in the upcoming lesson where we set up the arrest ful AP ice. Let's go ahead and get started. So the first thing I want to do is I want to create Amazon cognito user pool So I'm going to navigate to Amazon cognito and you guys and see I have one created from a previous lab. I'm going to go ahead and create a new user pool, and then we way we have a couple of weapons. We can either set everything up as default, or we can step through the specific settings. So if you step the specific settings, there's a host. After from options that you are able to configure and modify based on, for example, which attributes you want to require somebody fall that really requires an email. So if you want, for example, users to provide their names, their gender picture and so on, you can require that also, so the users will need to provide that before they're able to register and receive the verification token. So, depending on again what information you want and how you want to set that up, you're able to modify it that all three here. But I'm just going to stick with the defaults here with the review that let's review all of the different information and again, on the left hand side, this is all these are all of the customization is that you're able to do through Amazon cognito going to that is a bit outside the scope of this course, But just be where I would recommend you guys do. Walk through all of these attributes to see what you're able to configure and modify. So when we do so let's go ahead and create our pool after the pool is created. What we need to do is add a AP client to the user, pool us and see from the general setting. There's an option to create an APP client. We're going to create a client here. It gives an option off one heart. How frequently you want them to refresh the token, how long that specific token will last. So by defaults 30 days. But you can increase or decrease that, depending on how you're going to be using this within your own business case, I want to make sure that we un select this generate client secret because client secrets aren't supported for use with browser based applications, and since ours is going to be a browser based applications, we want to make sure that this is unchecked. We're gonna go ahead and create the air client and after we do that, we want to make sure that we copy the client I d. Because this will be used later. So I'm just going to copy this and paces in my no pad. So after we have that user pool created and we have the AP client created next thing going to do is update the config dot Js file in our website bucket and me to do that, it can reference this new cognito user pool. So I'm going to navigate to my s three bucket. But I want to do is download this config dot Js file. I'm gonna open it up in a text editor. I like to use sublime, but you can use any text editor that you want to modify this file. So here's where we need to modify this carnival section of the pool I d and the pool quiet . I d go ahead and put in all of this information. Click on save. I'm gonna go ahead and go Never get back into my s three bucket and I'm going toe up played Upload the newly modified config dot Js file There we go. We can see that the new modified file has been uploaded. Someone has done. Let's go ahead and test it out to see how that is working in our website. So I guess since even I feel of information, it gives me a verify email, and here I'm going to get a new email with the verification code. As he has conceded, I've gotten a new email with the verification goats. I'm going to copy this code. There we go as you get, since he gives me a message saying the verification of sex will now be redirected to the log in page. And now since we don't have the full website configured, obviously nothing's going to show up here. But if you had the full works that configured, everything would show up here. But again, this is just to show you how the authentication is going to work and it successfully authenticated, and the users are now able to log into the website 10. Creating the serverless backend: everybody. And welcome to this lesson on confronting our serverless back in soap intended up until this point, we have created a static website hosted on an S three bucket. We've also created our cognitive user pools which allows users to authenticate themselves before they're able to access certain parts off the website. So in this section, we're going to do is risky. Implement a back end for our website. We're going to use AWS is a Lambda and dynamodb to build a process in the back and for handling requests from the Web application. The first thing we need to do is create a database and we're gonna be using the dynamodb toe do that. So the first thing I'm going to do is navigate to the Dynamodb Management Council had in dynamodb. I'm going to just simply create a table, the table name. I'm going to call it rides, and you can either use the default settings or we can customize our own settings on again. Remember, A depending on what you're using within your business, what it will be used for. You can customise the settings for the utilisation for the read capacity and for the right capacity. But what we'll be doing is just sticking with the default information and default settings . You have to do that. I'm McCord and click on Create Table Art. This is your presidency. Our table has been created in the dynamodb. But we want to make sure we know down is the air and or the Amazon resource name for this dynamodb table. So now that we have our dynamodb created next, we need to create our lambda function. And in order to do that for us, read to create it I am or an Identity access management rule or the Lambda Function. So I'm going to go ahead and navigate into my I am console. I'm going to click on rolls in or to create a new role. And just for your reference of these roles are going to be created to allow the Lamba function. Certain permissions within the AWS resource is because by default, any function that you create, or any resource, even an easy two instance that you create in AWS requires certain permissions to access other AWS re sources. So by creating these roles, we are able to limit what access thes lambda functions will have in terms of what they can do within our AWS ecosystem. So we're going to go ahead and create any role we want to select Landau, and after that we're going to define the certain permissions for it. And there are 507 permissions that you can go through. Each this way is to just simply searchable you're doing. We're searching for the Landau, and we want the land of basic execution, and if you drop it down, it will let you know specifically what access it allows it to dio. You can also modify it by using the Jason editor. You can modify this policy if you want to customize it in any way, but we're just want to simply leave. Leave it as default tags again are optional. You can specify certain tags if you want to keep track off this land a function or if this is for a specific departments, Pacific region specific organization. So you're able to keep that this is solely for your tracking purposes for each organization where it's going to click on next for reviewing it. Did you see this rule has been created? So I'm gonna go into this role, I'm going to go into the permission stabs you guys can see, and I'm going to add a specific policy for this AWS Lambda Function role service. I want dynamodb for the actions I want. I want to give it access toe put That item for the resource is I want specific resource is and here's where we can or we can allow all. Resource also depends if you want this specific Lamba function. To have access to all of your dynamodb resource is, or only to specific ones obviously always recommended that we try to limit. Oh, it's always recommended to limit the amount of access that each role or each resource has obviously want allowed access to specific Resource is Here is where we can add the R N click on her view policy. I'm going to give this policy a name, and I'm going to go ahead and create the policy. So now that we have our role created for our Lamba function, let's go ahead and create the land but function itself so within the services I'm going to navigate to my Lambda Council. So here's what we're going to do. The lander function is basically going Teoh process the A p I request from the Web app to dispatch a specific unicorn that this website is develop around and in the next module is when will create the rest ful. Ap I that's going to expose the http endpoint on that can be invoked from the user's browsers. So let's go ahead and actually create the Lambda function. We're going to create a new function. Want to author this from scratch function Name. We're going to request one time we have, ah, hold of options in terms off. What technology want to use the dot net No jazz, python, ruby or even a customer in time. What we're going to do is just select no Js 6.1 token, depending on the so again, Depending on the Web app and the technology you're using, you can select whichever option would suit best for what you are trying to dio in terms of the permissions, you need to create a new role or choose an existing role. But since we already created a role, we're going to simply select that this web happened the role that we just created, and we want to go ahead and create dysfunction. Now that the basic bare bone function is created, we always he want to tell what this function should do. So we're going to simply add in the certain piece of code for it to request the unicorns from the website. There we go. So now that I have created this cold for to request those unicorns from website, I'm gonna go and click on Save Now that saved that's quiet and tested out to see if it's working properly. So we want to do is from this main screen we want to configured test events. We're going to create a new Testament to test out our land a function. After we do that, we're gonna go ahead and click on test and decency that the execution results succeeded means the Lambda function is working properly and feel click on the details that will give you very detailed information in terms of what it did, the input and the output of the lock So you can review that for your purposes are saved that for your record purposes, to see that lambda function is working properly and what the function actually did 11. RESTful APIs creation: everybody and welcome to this lost last module and configuring our restaurant Ap eyes with AWS Lambda and the A P I gateway. So in this lesson we're going to do is we're going to use the A p a gateway to expose the Lambda function that we just built in our previous lesson. Now the A P eyes went to be accessible are through the Internet for the static Web set which remember which we created in our first lesson. It's going to be secured using the Amazon Cognito user pool, which we also created in one of the previous lessons. So basically, we're going to do is we're going to use this configuration and turn our static website into a dynamic Web application by adding some client side JavaScript that makes Ajax calls to the exposed AP Ice. Now, the static website that we deployed in our s three bucket already has a page configured to interact with a P I that we're going to build in this module. The pages basically called a ride dot html and it has a simple map based interface for requesting a unicorn ride. So, after authenticating using the sign in html which, if you guys remember from one of our previous lessons, the users will be able to select their pickup location by clicking a point on the map and then requesting a ride by choosing request Unicorn button in the upper right hand corner. So in this lesson, let's get started. We're gonna focus on the steps required to build the cloud components off the A P I. So the first is we're going to create a new arrest. AP I by using the Amazon AP gateway. So I'm going to navigate to the A P a gateway from my management console someone to create a new A P I. Here's where you can select a protocol, whether we want rest or Web socket AP I name. I'm just going to call this Qassem a P I for the A P. I. Name the end point. We can have it either regional edge, optimized or private. Want to keep it edge optimized what this will do. It will use the cloud front edge locations which will minimise the Layton. See that users encounter when the access the website because Amazon has a host of edge locations scattered throughout the globe, we want to make sure that we minimize the late agency that users experience. And this is also a good tip for when you're deploying it into production. Ever do that? I'm going to create my a p I. So now that our A p I is created now, the Gateway is going to use the tokens returned by the cognitive pool to authenticate the A P I calls. So let's go ahead and configure and authorize er for R A P I we're gonna create in. You authorize er and type is we want the cognito. And here's where we need to put the name off the carnival user pool that we created if he had never recall it, causing more BAP and we're going to click on Create. So let's see, Let's verify our authorize a configuration and let's go ahead and visit our ride dot html page. I'm going to sign in with the user credentials I created in our last one. So there we go hard and logged into the ride dot HTM out and one do is copy this authentication coat. Go back into our A p I gateway and we want to test this new authorize, er, and this is where we're going to pace the authentication coat and test and you should get a response CO 200 meaning that the response has been authenticated at everything is properly created. So now we're going to create a new resource and method within our ride. I'm going to close this out. I'm going to go into the resource is and from the actions I'm going to create a new resource. They're going to make sure the resource path they set to ride because that is the page that we want to access. So depending on if you have your own website configured, if you've modified it, make sure that these reflect the same and I'm going to create the resource. So after that's created, make sure this is selected because we're going to create a new method linked to this. We're going to create a post method post. We're going to use Lambda function. If you remember, we created a lambda function who want to select the region that the Lambda function isn't. Art is in us East one and the Lambda function. You start typing it up. You guys will see the name of Papa. You remember I called the requests, but you want to put in whatever you called your lambda function, and we're gonna click on safe here. It just lets you know that you are about to give The AP gave me permission to invoke the Lambda function just to confirm that this is actually what you want to do. We're going to click on the method request in the authorization. You want to use the cognito poll that we created. There we go. So now it's going to use this cognito pool toe, authorize those users. So that's done. Let's go ahead and do the last step in terms off deploying our a p I from the actions you guys see. One action is a deploy a p I we're deploying this into production. You can subsequently give the stage of description and even the deploy ment subscription or a description and click on deploy. There goes. And now our web EP a P I has been deployed we want to do is no down this involve You are all so I'm going to copy this. So now we need to update our config dot Js file in our website to invoke this new you are out. So if you remember, we had updated the conflict out jazz to reference the cognitive pools in one of the previous lessons. So we're going to just open up that config dot Js file again. And in the invoke Ural, we're going to paste the URL that was referenced by the A P I We're going to save this file , and we now we need to upload this new file in our s three bucket. I'm going to navigate into my S three council and simply upload the new config dot Js file . There we go. We see that the time has changed me. The new file has adjustment uploaded. So now let's go ahead and never get back into our ride dot html page. So I'm going to test this out. Let's say I want to pick up location to be zoom in a little bit. Let's say this is my pickup location. I would click here and click on request Unicorn. There we go. You see that? The unicorn is there. This is my pickup location and you can see the messages here Also, the unicorn is on its way and there we go. You have just completed a reading a serverless of web application 12. Image processing architecture: Hi, everybody, and welcome this lesson on this section on building an image processing serverless framework. So let's see, what were I would just want to take the steps are for what we will be going through and developing in this section. In the previous section, we basically developed a Web in which was in which users were able to book a unicorn to be transported from point A to point B. So in this section or go to do is we want Teoh, have our users upload a photo of themselves. I'm in order for the US to verify to make sure that the same person is the one that booked the at your book, the uniforms. So what we want to do what we want to verify. The photo shows a clear face also, For example, the drivers of the Unicorns and identify who is going to be the writer want to match that against the collection of previously indexed faces to make sure that the user hasn't already signed up. We want to resize the photo to thumbnails to displayed in the APP. We want to index the user's face into collection so it can be used for matching in the future. And then, finally, we want to store the photo metadata with the user's profile. So here's how the architecture is going toe work. Not everything is going to be done through Lambda functions, so it's going to be composed of several lander functions that will lovers the facial detection capabilities off the Amazon recognition. Then we're going to store the data in as three buckets, and then we're going Teoh store the image metadata and the user profile in the Dynamo DB. Now all of this, all of the land of functions are going to be or the orchestration off the lander functions are going to be managed or run through something called the AWS Step Functions for AWS State machine. This graph basically shows you what the step function or what AWS step functions will do. So we'll have in the beginning, will have the face detection, and the first step is going to check for if the face already exists in the database or not . If the photo already exists, then it can skip the next two steps and it can go to the Persist major data and go to the end. Additionally, It can also check if the photo meets the requirements such as, for example, I want to make sure that the photos are not blurry and we can properly see and view the person that is within the image. So if it does not meet, the requirement is gonna go to the end. So they have to start all over again. If, for example, the face is not a duplicate and the picture is clear, then we could create the thumbnail added to the index. Then we could do the metadata in the dynamodb, and then the function will and there. So this is essentially what we will be creating in the upcoming lessons in this section. 13. Creating Recoknition collection and Backend: everybody welcome this lesson in which we're going to create a Amazon recognition collection and then we'll launch a cloth permission template that's going to create our entire back end in terms of the S three, the Lambda Functions and the Dynamo Devi. So the first thing I'm going to do is to the command line interface. I'm going to create a Amazon recognition collection on again. A face collection is busy would be container in the recognition to store indexed face images as searchable vectors. So I'm going to use this command line AWS recognition create collection in the region I have selected as you East one. So depending on which region you are working in, make sure that you change it over there and I'm going to name the collection I d writer photos. There we go. And if it's successful, it will return. A status code of 200 will give me the collection are Ed and they want model reason. Currently working on is 4.0, So next we're going to launch a cloud formacion template and I have included the u R l for it for you guys to launch also on depending on which region I've always stuck with us East . One this because it's Northern Virginia and most off, the new services are always available in that region, and they're always launched from that region also. So I'm gonna go ahead and launch the confirmation stack, and then you guys can see that Monta click on There's gonna take with a long stack. It's going to specify the template, the Amazonas through your l. This is where it's pulling. Everything from the ammo file contains all the information. And if you guys want more information, if you click on the view and designer, it will take you through a designer a Gui Gui interface. It will let you know all of the services that are going to be provisioned through this confirmation template. Yes, and see all of the different services that are being provisioned through this cloth for mission template in terms of land, off lambda functions of photos and everything. So again, you are also able to create it through this designer. But since it's already created for us, we're just going to use that specific temp. Time to click on next stack name, you can change it. I'm just going to leave it as default. The recognition collection idea can make sure you know, if you've named yours differently When you ran the command line, make sure you referenced that here. Also, I'm gonna click on next, click on next again and here toward the bottom. You have to acknowledge that you want that you want to allow this cloud formation template to create resource is on your behalf because you guys are on the designer. It's going to permissions. Services creates him. I am rolls and policies. So you want to make sure or you have to act to give it permission to create those on your behalf. Want that's done. Go and click on create stack. And as you can see, the creation is progress. And if you click on the refresh button, it will take to the entire process. So there goes. When we have our cloud formation Template Launch is going to create all of our back and services, and the next step is creating the AWS step functions to take the image to that specific process. 14. Creating a Step Function: everybody and welcome this lesson on creating our step functions. So up until now we have created the Amazon recognition containers. We've creator back end through the confirmation template. Next, let's we're going to create our initial AWS Step functions state machine. So the first thing we want to do is you guys can see you can use any text attitude that you want. I use sublime and we're going to use this writer photo share. State machine. Jason was basically simple. Jason. That's going to detect the face and make sure that it meets the requirements in terms of it not being blurry. A couple things you want to know. It is in the reason and the resource. You want to make sure that you put the R N off your specific resource. So if you go back into our AWS council in our confirmation stack that was just launched, you'll have an output section and in the output section, it will give our Amazon resource numbers or names for all of these key functions that have been launched to this claw information template. So first, more to do you want to grab the face detection RM and plug that in here? Four face detection. Next thing want to do is for this last one for the photo does not meet requirement. We want to send them a notification. And that's this place holder function. So for so you want to copy this and make sure we paste that here and we're going to save this file as writer dash Photo dash State Dash Lucien job that Jason and I've also included that in the dangled sections you can simply download the file and just make sure that you change. These two are ends, too. Whatever the output in your AWS account has been done when you launch the call information template. So after we do that next want to do is create the step function. So we're going to go on the services and going to the step functions Dashboard, if you have not uses before, you will get the same exact screen where you can go to get started and will create our first state machine. So, for the name, we're gonna call it writer photo processing and we want to do is going to copy this code and paste it in here. I want you to that I'm going click on next and for the I am a role we want to choose an existing one because I am roles were created through the claw information template, and this rule was should already have been created if the template was launched properly. The step module resource is state machine rolls. Want to make sure that this is selected and when I click on Create state machine? So here's where we can specify the execution, not eat Execution of a step function state machine has unique I. D. So you can specify a 11 starting execution or have the service generate one for you. In the word, says the entered execution name, it's one thing to do is make sure for the estimate bucket. You want to go back into your claw information and in the output section, find where it said the rider photo as three bucket. You want to copy this A. R N. And make sure that's the one referencing your s three bucket. Then we're gonna go and click on Start execution. They're gonna go. You guys conceive that there These executions happened. Success hope so. That means our first step function is working properly in terms off that them uploading photos and ensuring that the faces are recognizable and that they are not blurry. 15. Modifying and testing the step functions: everybody. And welcome to this necklace in on how we can prevent face duplication in the step functions. The first you want to do is we're going to modify the Jason we had created in the last lesson and simply add this check face duplicate section into it. I've also included this in the Donald sections. We can also download her, but just make sure you changed. The first to resource is and then secondly, for the Czech Face Tobel, get me. We also need to change that to our R. And so if you go back into Arklow information template, we want to grab the fish face search function air end and make sure we include that in the Czech face to book it section of it. So after that, I'm just going to copy the entire thing. Go back into my step, functions more to select the state machine that I had created. When I click on edit, I'm going to replace this previous Jason with the one that we just created, and I'm going to click on safe. We don't know, as you can see, that it's also going to check for face duplication and also along with the requirements, which we did in the previous lesson. China. We've added duplication. Let's also add a parallel processing step. So if you upload the photo passes both of face detection and the face to book a stage, we could not proceed. Index. The riders face and resize a photo for displaying in the APP. Since these two steps don't depend on one another, they could be running parallel. That's what we're going to do now. So first thing we need to do is go back into our Jason and modify it to include a parallel processing step. So just to see, I've added these parallel processing steps at the same time. So we're going to do is copy this, Jason, go back into our step functions and just like we did before, we're going to update that again. And now you guys can see that these parallel processing steps have also been added. So let's go ahead and test it out with the execution that we ran the very first time there goes, conceded extrication executions status has succeeded. And if you go back into our the command line interface and we can check to see if recognition if the AWS recognition has actually run the process on the step function we just executed. And as you can see, the one we executed. It does have that face in the thumbnail. So it if we go back into our step functions. So I basically took that image. It detected the face it could found that there was no duplicate. It created the thumbnail, and it saved that into our s three bucket at the same time. If we go into our s three bucket and we go into our thumbnails, you guys will see that there is one resized happy face image that we just ran that step function on. Now, as the last step, we want to add that meta data persistent step to utilize our dynamodb. So just like with all the other ones, what we're going to do is modify the Jason file. You said you could see ever had out of this persist meta data and you want to grab that same air and from Arklow information template, which was just for the process meta data function, which can be found right here. And we're gonna go back into our execution. I'm gonna go back into our state machines were going to edit our state machine and add the new Jason right here. There we go and he gets going to see after the parallel processing way of the Persist metadata, and then the process comes to a close. So let's go ahead and test this final state machine as you guys can see one of the execution. I have a picture of the sunglasses and it sent out a message saying the faces wearing sunglasses so it went through. And it if you scroll down, you can see that have detected the face and Detective Photo is not meet the requirements and it came to an end, sending a message back to the user saying Upload and other photos. Let's try another execution since you have uploaded afforded that has multiple faces. It's currently detecting in the face detection. And again it saw that it does not meet the requirements and you guys can see in the output Detective three faces in the photo, so besting. Now you have built a multi step image processing workflow. Using the step functions mother work focus being integrated into your app by fronting it with AWS AP gateway or triggered from an Amazon as three upload event