Serverless with AWS Lambda

Deploy on AWS Exercise

Scott Moss

Scott Moss

Superfilter AI
Serverless with AWS Lambda

Check out a free preview of the full Serverless with AWS Lambda course

The "Deploy on AWS Exercise" Lesson is part of the full, Serverless with AWS Lambda course featured in this preview video. Here's what you'd learn in this lesson:

In this exercise, students deploy and use lambdas on AWS using a serverless framework.


Transcript from the "Deploy on AWS Exercise" Lesson

>> Scott Moss: So if you haven't already, what you're gonna be doing is you're gonna be deploying your stack. So everybody knows the command to deploy right? It's deploy. So [LAUGH] what I want you to do is to deploy it and then I want to see if, check and see if you can actually access your API.

Try to access it through curl, and then try to access it in a browser, and see if it actually works. So some of you it might fail on the browser, for others it might not, and I wanna know if people know why. In curl it should probably always pass but in a browser it could possibly fails.

So check that out and if you do, use your debugging powers that I just taught you about, by looking at the logs inside of cloud. My God, which one is it? There's so many clouds. Cloud, Cloud, my God, okay. Okay, let's go back.
>> Scott Moss: It's gotta be, I wanna say Cloud trail but like, like there is so many clouds.

Cloud watch, okay, wow. Cloud watch, yes, if you've got a Cloud watch, then you click on logs. Then you click on your function and then you'll see logs like as I have right here. So if I click on this I can see all the logs that were executed, and basically, these logs are just like, these aren't logs that I logged.

These are just an Amazon login that a request was started and then a request ended, that's all these logs are, and then, it will tell you how long it took. This was 12.3 milliseconds. Billed Duration, the minimum like I said is always 100 milliseconds and this is your memory.

So then yeah, that's how you know how much their charging you. So then you go write another lambda that's subscribe to this log and then counts it for you. So when Amazon tries to overcharge you, you can like no, I've been counting all of these and in fact, I don't owe you that much money.

So just read that somebody did that and they got a lot of, Amazon had to get the money back. So I thought it was really funny. I was like, wow! That's an overkill. So yeah, do that, and one last trick is you can actually look at your logs here, if you type in serverless -f, and then you give it a function name, you can just stream your logs here.

So -f, the function name will be API and this will just give you a logs like as is right now, but if you want to stream them I believe you need to type in -t to stream them and the logs will just come in in real time. So you can see them here as well.

>> Scott Moss: So those are all my tricks, that's all I got.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now