Serverless with AWS Lambda

CloudFormation & Serverless Framework

Scott Moss

Scott Moss

Initialized
Serverless with AWS Lambda

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

The "CloudFormation & Serverless Framework" 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:

Scott reviews the serverless framework, which creates an abstraction that is easier to work in conjunction with AWS CloudFormation. AWS CloudFormation allows for using different services across AWS with one configuration.

Preview
Close

Transcript from the "CloudFormation & Serverless Framework" Lesson

[00:00:00]
>> Scott Moss: Now, how would you test this locally, right? How would you run, how could you test booking your hotel locally on your machine? There's just no way. But if you click on it, it'll give you this object right here. And the reason that I showed you that event.json before is because that workflow allows you to take this object, bring it back to your machine locally, and now you can write your lamda's to respond to this type of event.

[00:00:23]
And therefore, you can run it locally. But again, I said there's trade-offs. Because if your lambda's using resources that AWS needs, or that it needs AWS, then it might be kind of hard to run it locally. So you still might have to test it in AWS itself. So it really depends on your Lambda and what it's doing, and what resources it's trying to grab.

[00:00:44]
But this is probably the closest thing you're gonna get to running a local uses. It's grabbing this event object, messing around with the payload, and then testing your Lambda functions. It's also great for testing as well to make sure your Lambda responds to these types of events. Does that make sense?

[00:01:00]
>> Scott Moss: Cool, and then, as far as testing it on AWS, again, you click this Test button, when you select this event, you pick the event that you want. You can give it a name to save it later. You could even create your own custom event. You just hit this Create right here, or I'll give it a name.

[00:01:20]
>> Scott Moss: My God, there we go.
>> Scott Moss: I'll hit Create. So that'll make the event, you can see it's loaded up right here. And if I just hit Test, it's going to run my lambda with that event. And then, I can look at the logs and look at the details, and I can see what happened.

[00:01:34]
So this is how you would test it on AWS itself.
>> Scott Moss: Everybody follow me there? And that's about literally all I do on AWS with lambda. When it comes with anything else with lambda, I don't touch anything else on AWS. There's really not much else you have to touch.

[00:01:50]
When you get to the deployment, you'll see everything we do here can pretty much be configured through Serverless. And without getting too deep, that's because Serverless is using something called Cloud Formation. Does anybody ever use CloudFormation?
>> Scott Moss: Kinda, okay, all right. Cloud Formation is basically like, okay, you see all this crap here?

[00:02:13]
Instead of coming on here and clicking on all the services you need and trying to tie them together, CloudFormation is an API that you can use from the CLI that does it for you. You basically create a configuration file that's a CloudFormation file, and you send that to Amazon.

[00:02:29]
Amazon creates all this stuff for you. That's what CloudFormation is. But even that file's really hard to use. So service is an abstraction on top of that file. That's basically what service is, it's an abstraction on top of AWS' abstraction. That's how complicated it is. So that means whatever is available on CloudFormation, we also have available on Serverless.

[00:02:51]
And support for CloudFormation as far as these services go, are pretty high. I would say Amazon has at least 80% of all their services on CloudFormation, and they're adding more support daily. So if it's on CloudFormation, Service also has it. Therefore, we can configure it inside of our YAML file.

[00:03:08]
Therefore, we'd never have to come in here. So, really cool.

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