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

The "Introduction" 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 discusses the prerequisites and architecture of the application built throughout the course. The Go application is a simple API server with user authentication. Users can log in or create accounts. When a user is authenticated, a JWT is issued. The application will be deployed as a Lambda on AWS.

Preview
Close

Transcript from the "Introduction" Lesson

[00:00:00]
>> Welcome everyone. I'm very excited to present this course. I want to say that, first, who is this course for? And if you've ever written any Go, I think you're gonna benefit from this. If you've never written a lick of Go, I think you're gonna benefit from this.

[00:00:16]
Same thing with AWS. If you're familiar with AWS, awesome. Never touched it, sweet, because what we're gonna do is build off the knowledge from the Go side, build off the knowledge from the AWS side, and just put them together to build software. So I'm gonna pick up these kind of beginner principles, intermediate concepts into a fully deployed piece of software.

[00:00:40]
And it's gonna be pretty exciting. Maybe there's some things with Go that I'll explain that you've never known before, or AWS. So that's the gist of this course. We have to start with the classic Hello World slide. My name is Melkey. I am a machine learning infrastructure engineer at Twitch.

[00:01:00]
It's a really cool sounding title, but really I'm not the smart person making these neural networks, making these ML models, I work with the scientists who do. So my job is very bare-boned software engineer. I take the model artifact that they've created, they've deployed, smart PhD people, and then the question I have to solve is, how do we make this usable?

[00:01:25]
We just have a bunch of expensive scientists build something, now I have to make it serviceable in a production level environment, make an application around it. So that's kind of my role, I build infrastructure, I build the code around it, and try to make it serviceable for Twitch.

[00:01:43]
And I've worked on a bunch of different features at Twitch, touching gifting flow, fraud prevention, all of that, I've had my hands dabbled around there. So I've been there for almost three years, and it's been fun. I stream live code at twitch.tv/melkey. So, if you're watching there, awesome, shout out.

[00:02:00]
I also make videos on my YouTube channel, a lot of them are Go related. A lot of them just things in tech kind of the world from my perspective. But I think the most important thing is this last line, and it's I make mistakes and there's gonna be mistakes.

[00:02:16]
So if you think this is gonna be flawless, perfect course from start to finish, it's not gonna be it. I'm gonna make mistakes. I'm gonna fumble. You're gonna make mistakes. You're gonna fumble. But we're gonna solve them together. And I think that's really that live workshop element where I want to be very back and forth cohesive, we kind of figure things out together as we go.

[00:02:35]
Pun intended. So what's in this course? There's a table of content slide, it looks pretty nice. We're in the first one where I'm introducing the course, talking about the prerequisites, which I think everyone here has already set up. I think there may have been a little bit more prerequisites involved with this one than maybe some other courses, so I appreciate everyone kind of setting it up.

[00:02:55]
I'm gonna talk about the general course info, what we're gonna do. And then will I jump into learning some Go? I'm gonna talk about the philosophy and concepts of Go, why it was designed the way it is. I know some people have used Go, which is great. Some people may have never used it, which is also great.

[00:03:13]
So I wanna talk and refresh ourselves about what it means to write Go from the people who actually made it. So not from my mouth, but from the actual engineers at Google who made it way back when. Then we're gonna go into AWS, Amazon Web Services. In my opinion, that's going to be the most exciting part because we're gonna take those concepts from Go, roll them into actually deploying them using infrastructure, using a framework that AWS provided.

[00:03:42]
And then we'll see it all come together at the end. So we're gonna build off these blocks, very similar to how CDK has the concept of constructs, which we'll get into in just a little bit here. So yeah, that's the introduction. Prereqs, so everyone here should have everything.

[00:03:59]
But if you don't, if you're watching this, the first one is have Go installed. No surprise, this is a Go course. So have Go installed. My suggestion, always try to get the latest version, but Go is boring. So if you miss a version for whatever, life gets busy, just don't see it, don't fret.

[00:04:18]
There's not gonna be anything monumental. Go kinda moves at this controlled cadence where if I were to bet my money, there will never be a Go 2.0 release. There's never gonna be a major release like Python 2 to Python 3, where you have to rewrite all their apps or migrate them.

[00:04:34]
Go moves pretty controlled, so have it installed. If you can't get 122, at least try to get 118, that's where generics are involved. I think that's where more of a substantial update may have occurred. But moving forward, you also need an AWS account. Everything we're gonna touch today, goes under the free tier.

[00:04:55]
I know AWS has this boogeyman monitor, like if you have something running, you're gonna have a giant bill at the end. We're definitely gonna avoid that. We're not building anything, no Netflix level traffic here. So everything, we're gonna use it the free tier. And following that, you're going to need the AWS CLI, so make sure you have that installed.

[00:05:15]
It's a pretty straightforward installation, whether you're on Mac, Windows, Linux, whatever, and configure your credentials. So have your .AWS files configured. You can configure all that using the AWS configure command at the bottom. So that will run you through pretty simple CLI script to match your credentials, match your region, account number.

[00:05:34]
So if you haven't, maybe do that now, if you have, awesome, thumbs up. And then have CDK installed. CDK is the framework AWS made. It's what's going to allow us to communicate to AWS without having to go on their UI. We don't have to go on the UI at all.

[00:05:51]
We can literally do everything from your IDE, whether that's VSCode, Neovim, whatever, you just have it popped open and you're good. Question?
>> What language are we using the CDK with?
>> Go, baby. I love that question cuz I originally wrote this course using TypeScript for CDK, cuz that's where CDk was natively written, but then it hit me, why?

[00:06:13]
Why would I have an intro to Go course deploying Go application logic with TypeScript CDK? I was just like, let's just do everything in Go. Why not? Let's just double down, triple down on this Go usage. So yeah, everything's gonna be written in Go. No TypeScript here, okay?

[00:06:28]
There's no TypeScript at all. We're not gonna be touching that in this workshop. Cool, so goals of this course. All right, there is four goals. First is to teach a basic Go. I know a lot of people here have already used Go, have experience with Go. That's awesome.

[00:06:45]
That's wonderful. So we're gonna breeze through that. We're going to touch on the data structures that I think are important to Go, but data structures and principles of Go that are actually going to use when we build the software. Go is a programming language built by people who are much smarter than me.

[00:07:03]
There's a lot to it. Even though it's a simple language, I just don't wanna go through every niche detail of it if we're not gonna use it in the AWS portion, right? So in that kind of beginner slot, everything we're gonna be introducing there, it's gonna roll over into the next portions, right?

[00:07:21]
We're gonna also introduce design patterns of Go and recognize common gotchas. Every language is gonna have gotchas. People who wrote languages wrote them for a reason, and there's things you may be scratching your head like why did the team choose to do it that way? Why is it this?

[00:07:39]
What does this even mean? So I wanna show some gotchas that, obviously, I go through that, we've probably gone through already, highlight them. And then the third point is introduce how to use Go with the most popular cloud provider. That's a fact. That's just not me trying to sell you on anything, that's just how it is.

[00:07:56]
The market share, AWS is king. And we're gonna go through all of this in detail, but how do we use a great language like Go with a popular cloud provider? And then the fourth portion is, how do we actually deploy infrastructure, and run Go code in a production level environment?

[00:08:13]
So we have a bunch of info that we're gonna deploy, we're gonna have all of our Go code deploying that, and we're gonna have our actual application logic written in Go as well.
>> What's your thoughts on Terraform, that it's written in Go?
>> I mean, personally, I chose to use CDK, could have done it with Terraform.

[00:08:32]
My personal preference is CDK. It just feels more natural from a software development perspective, like writing code, you're not just writing a YAML file or whatever, right? You're just writing functions, you're passing that function around into a hierarchy tree. So to me, it just feels a little bit more fluent than running CDK, feels more like, okay, I'm just writing code, assembling it, versus making sure I write this script, this file, which then gets deployed.

[00:08:59]
So my personal preference has always been CDK. So target audience, I think I touched on this a little bit in the beginning, but it's anyone who just wants to learn. I think that's the best way I can say it. It's anybody who wants to learn anything. I know talking to some of the people in the workshop, there's a diverse group of individuals who come from different backgrounds, whether it's your pro at front end, you're a master back in whatever.

[00:09:24]
I think if you just wanna learn something new, this is a great workshop. And obviously it's particularly targeted to those maybe new to Go, new to AWS or vice versa. And one key thing I wanna say, it's let's say at the end of this you still wanna go to your bread and butter.

[00:09:40]
Let's say you're a PHP dev, Java dev, Python dev, whatever it could be, I want you to still be able to incorporate AWS into what you're familiar with, right? Or let's say you are a master at Go, but you just don't like AWS for whatever reason. Let's say the docs aren't there, maybe the company you're working for use Azure, GCP, then swap it, right?

[00:10:00]
So maybe there's something in those two components that you like, that's kind of the perfect audience, in my opinion, for this course. Okay, so what are we gonna be building? I have this beautiful diagram, and I know you guys are thinking that I'm an artist, which I am.

[00:10:17]
But this is it. I mean, this is the workshop. Thank you for coming. But we have this client box all the way to the left, and that's gonna be making requests. And we're gonna have this nice green vertical box called API Gateway. It's gonna take these requests to go and do some logic and do some magic.

[00:10:36]
And it's gonna just send it over to this orange box called Lambda, all right? We're gonna get into what a Lambda is, but the cool part is there's a box within the Lambda box which says Go code. We're gonna write that Go code. We're gonna package it up.

[00:10:50]
We're gonna shove it into this Lambda, deploy it, and it's gonna receive requests essentially from the API Gateway, all right? And this API Gateway, we'll go into all of this in more detail, but the AWS Gateway is basically acting as a proxy for us. It's receiving these incoming requests from our client.

[00:11:09]
It's gonna say, okay, who are you? Are you even allowed to query us? What do you want? Where do you wanna go? We'll go into all this and more. And then lastly, we are gonna go into this DynamoDB, a database. So we're gonna actually take requests, put them into a DB, and then take all of that and send it back to our client.

[00:11:25]
Did it work? Did it not work? Why did it not work? So this is the end-to-end architecture of what we're going to build. And then here's a more sophisticated diagram. You have the Gateway, the Lambda function, and Amazon DynamoDB. If you've never touched any of these pieces of infrastructure or you may be confused as to what you are, that's good.

[00:11:53]
I'm gonna go into detail into all of these further down, but this is how and Go interact together. There's gonna be this concept of an IAM role, permissions. But what I really enjoy when I was building this, and obviously I'm biased cuz I built this course, but I really like the fact that we can literally send something from our computer, write it all out, type it, get really heavy and dirty with it, deploy.

[00:12:18]
And it's no longer on our computer, it's on the cloud. And then we can send requests to each other. We can send requests to ourselves, and actually see our DB processing those requests, storing them, and we get the request back. So I think that's really cool. Nothing's on the local machine.

[00:12:34]
You're not gonna have a process on localhost 3000 or localhost 8081 running anything. So it's all deployed. That's how we're gonna be running this code. And this is a deeper dive into the architecture diagram, more from application perspective, right? What are we gonna do? So we have a client, we're gonna basically have two endpoints.

[00:12:54]
We want to register a new user, or we want to log them in. Register, pretty simple, we're gonna get a JSON payload with your username, plaintext password. We're gonna hash that, store in our DB, we're done. Second endpoint, login. Are they registered, yes, awesome. Does the plaintext password I'm providing in the JSON match the hashed password in the DynamoDB?

[00:13:18]
It is, cool. And then we go to this next part, which is issuing a JWT, pronounced jot, and it stands for JSON Web token. And this acts as an access card, like a batch card, right? If you enter this building or enter anything, you have to scan your badge.

[00:13:36]
And depending on who you are, depending on the permissions of your card, you have different rules. Can you enter this room or not? So this is a TLD or an authentication method, which are gonna go more in depth down the line. But this is truly the course broken down.

[00:13:51]
We're gonna have the whole kind of interaction with our user to our entire system, issuing a way to authenticate them, and rock and roll with that. So I think, holistically, it's a pretty simple, straightforward application, essentially like a REST API. But there's a lot of intricacies that are introduced when you wanna deploy it on AWS, especially on scale, right?

[00:14:15]
Cuz what I'm introducing here, it can handle 0 traffic to 100, to 1,000, to 10,000 with the infrastructure that we're going to be using. So I'm excited, I hope you are too.

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