Build Go Apps That Scale on AWS

Testing the Deployment



Build Go Apps That Scale on AWS

Check out a free preview of the full Build Go Apps That Scale on AWS course

The "Testing the Deployment" Lesson is part of the full, Build Go Apps That Scale on AWS course featured in this preview video. Here's what you'd learn in this lesson:

Melkey demonstrates how to view the lambda through the AWS CloudFormation console. A sample JSON payload is configured, and the lambda is tested.


Transcript from the "Testing the Deployment" Lesson

>> Now, if we go back, right? So okay, our CLI gave us the thumbs up, sweet, everyone's happy. We can go to AWS and click CloudFormation, and if you click it, boom, new stack. Go CDK stack, created, better be created when you made it, there's a status of it, okay?

And you can drop down and click this Go CDK, and it gives you a lot of info on this. Stack info events, so right now we've creation event, you can see what it took to create, it took a log for what was created for events. And you can say, if you deploy someone to delete it, it will be here in your event stack, right?

Because remember, a stack is not only a lambda. Right now it is, but a stack could have a bunch of different resources and if you delete one resource, but not the stack, that will be highlighted here. And then we have resources. Resources is interesting cuz this is what we actually care about, the infra.

You can see here my lambda function, right? The unique ID, the logical ID for that's right there. If you click that, you can actually click this physical ID link. So let me just open this up, you click this physical ID, and it takes you to our Lambda portal, a Lambda UI right here.

This is a bunch of different properties to the package size, right? So that zip function that we deployed, with our Go binary, 5.3 megabytes certain hashes, a lot of cool information handler, the runtime Amazon Linux 2023, right? We've configured all that. And now we should probably test it.

So there's a little nice tab called Test, and in here event JSON. So we can actually go ahead and test our code here. So, it has key 1, value1. What will happen if I run this as is?
>> Error.
>> Yeah, cuz we're expecting the username, right? Because we actually have that function, that logic listed in.

So we can put username, and let's put any username. Put yours, I'm gonna put Melkey as mine, Shmelkey, cool. And then you can click test. Succeeded. You go here, successfully called by Melkey. Now, this is pretty simple, but it's really cool in a sense because now we've deployed back-end logic.

Of course it's simple, but let's ignore that for a second, into the cloud. We can run things in the cloud and invoke it. It's not on our machine. We have nothing running on our machine right now. So I think this is like, I always geek out about this.

You can see different execution times, 31 seconds, request ID, a lot of different things that maps to your Lambda, okay? And one interesting tidbit that I could throw in here is you can actually see Monitor, and you can actually see your logs. So if you click Monitor and view CloudWatch Logs and even Insights, you can see a number of invocations, you can see a bunch of different things I'll populate in these fields here.

So if you open up CloudWatch Logs. This is where you're gonna have more information as to what is happening to your function, to your lambdas. You can see there's a log stream. This is data to the execution hash, the latest timestamp. So if you dig this, you can see here it executed, it has a report time and anything you wanna log, this is where you will see it, okay?

>> How did you know that if you had to build for the AMD 64 architecture and is that just in the dock somewhere?
>> Yeah, that's literally in the docks when you see the runtime migration docks, eight of it is provided. They specify that they want the AMD 64 for CloudWatch.

Yeah, yep, yep.

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