over 1 year ago Syntax Podcast
AWS and IAC for Dummies with SST
- 02:33 Many providers work with SST like AWS, Cloudflare, Stripe
- 03:21 Century monitors app errors during infrastructure changes
- 04:03 Scott moved HabitPath app to AWS for better performance
- 08:47 SST config sets up PostgreSQL database
- 11:00 SES provides email sending credentials
- 16:22 Dev environment runs services like database and functions
- 18:31 SST similar to Kubernetes config with TypeScript
- 23:24 Pricing reasonable for small to medium complexity apps
- 27:50 Tunneling provides access to private production resources
- 30:12 Begin creates initial IAM access then configures resources
- 31:58 Forgetting Cloudflare cache rules only remaining manual step
- 33:49 Infrastructure as code allows complex architectures
Pricing reasonable for small to medium complexity apps
Scott Tolinski
the database variable that comes from my Postgres definition.
Scott Tolinski
And then I can use this interpolate I would imagine, when I was looking at the what does it take for this to become a paid product, it's not anything that I'm close to hitting. So it's I haven't really looked too much at it, but it was really reasonable. And and what this JS, again, is this is exactly So it's slow. It's slow where I am for a lot of reasons, but it's it's, like, for hobby projects. But, like, now that I got users on this thing, it's like,
Scott Tolinski
And it it works super well directly with the AWS s three client, but you can do this with any of your resources, You know, maybe Dax can answer that for us. There's a good chance it could because it does so much other things. I don't wanna say it doesn't. But I did it by hand, and it wasn't that tough,
Scott Tolinski
work through a config like this is something that has been really nice for me. Let's talk a little bit more. I mentioned that, like, I don't have to use a lot of environment variables inside of, like, click ops or or copying and pasting them or anything like that. Or even in my dev environment, I'm not having to use that a lot because SST allows you to do some things here. So for instance, like, But, yeah, you config configure all of this stuff inside of,
Scott Tolinski
large app. Right? You have you have a front end. You have a back end. You have a database. It's a sync server. I have an email service. That's a great question. I don't know how to other than just by, like, straight up counting them, which will take forever here.
Scott Tolinski
to upload files.
Wes Bos
three times more complex than it would be,
Scott Tolinski
You can there's SST runtime things. So the code I'm showing on the screen, and I'll talk through it, is using s three, an SST
Wes Bos
$25
Scott Tolinski
Yeah. Like, the SST certificate,
Scott Tolinski
SSL validation.
Wes Bos
Is this is this is a relatively
Scott Tolinski
I would say looking at this, it's probably less than a hundred. Yeah. It looks like it. Okay. Maybe more than 50. Yeah. Maybe around 50 something. Who knows?
Scott Tolinski
That's that's exactly correct. And and so, like, getting into this stuff has been really great because I do feel like AWS is not something I necessarily have the time to get a degree in. You know? So for me, being able to,
Wes Bos
Yeah. Even just, like, if you were to think about if you had three times that, that'd probably be $25
Wes Bos
a month because Yeah.
Scott Tolinski
even if those buckets are all different locations necessarily.
Scott Tolinski
And what they're able to do is from the SST package, they're able to import resource, and then they're able to access the current bucket with resource, my bucket, and then dot name. And that all comes directly from your SST config. So, therefore, it will work in dev. It will work in prod. It will work in staging, Just something. Who knows what? Yeah. One thing I I just kinda glossed over a little bit was this link. When I showed you the SST in the runtime stuff,
Scott Tolinski
But, again, I haven't I haven't gotten to that limit yet, so I haven't even thought about it. And this is all I need. So, like, now that I have this Yeah. I'm, like, good. I'm golden. I don't need to add anything else for this.
Scott Tolinski
in my website, I can pass in that connection string that's generated from SST.
Scott Tolinski
And, likewise, the database,
Wes Bos
a month. Yeah. And if your app was
Wes Bos
then you probably are okay with spending
Scott Tolinski
So, you know, super nice there. So, again, you're you're defining a lot of this stuff in this single file, like a a paid managed service. Now I gotta now I gotta keep track of another billing and another service Wes with this, I can fire up a database directly.
Scott Tolinski
let's say I did need the database connection string, which I I did, I can use And then well, this is just saying for production, use Cloudflare as a DNS, and I gave it this override true because it was having some issues creating and recreating it. But
Scott Tolinski
especially things like oftentimes, they'll recommend using the SST config to pull out, the database,
Transcript
Wes Bos
configure
Scott Tolinski
And I've been deploying things on AWS
Scott Tolinski
Terraform is infrastructure as code. We've talked about that in one of our episodes about bare metal. That was, like, really super good, where what you have with infrastructure as code
Scott Tolinski
And it's not just AWS like I mentioned.
Scott Tolinski
There's a whole bunch, and we'll talk all about more of those.
Scott Tolinski
30 different things in AWS. And I don't have to know what those things are. I don't have to click through the GUIs. I don't have to, get all my roles and all that stuff. So we're gonna be talking all about how you can utilize these skills to both deploy on AWS I'm gonna,
Wes Bos
deployment architecture with code. So this is not something you build an an app with, but it's it's a way to put all the pieces together, which is like
Scott Tolinski
We had Dax Rad on the show a little while ago to talk about SST and some of the things he's been up to, but I hadn't gotten my hands dirty with it until now.
Scott Tolinski
it makes it way easier than ever having to deal with AWS I can have any type of database I want. I can have it available in my application, and I can do it in absolutely no time with, like, a couple liners in a config. And to me, that is very powerful. Yeah. It's very, very powerful. So, yeah, I I'm pretty sold on SST as a platform. And, again, it's not just AWS. It's a 50 plus providers, including CloudFlare, if you wanna deploy things to CloudFlare or products on Stripe or that type of thing. And it's it's really pretty pretty sick.
Scott Tolinski
and, so you can get the logs for both your your your any of your processes that have them. So my Lambda JS for my SvelteKit site or my Deno sync service. You get logs.
Scott Tolinski
it it is basically like a nicer way to work with something like Terraform.
Scott Tolinski
JS well as anywhere that supports, This might be the VPC. This is the cluster, the EC,
Wes Bos
correct me if I'm wrong, but this is a
Scott Tolinski
Today, we're gonna be talking about infrastructure as code and Coolify. Okay. In Coolify, there's no problem with Coolify. The thing is is that my Coolify server is like a hobby server. It's for, like, hobby projects for me. And in fact, because of that, it's a it's an Yarn server, and the only place that, Hetzner has ARM servers is, like, overseas.
Scott Tolinski
is that you are defining the way that all of your services and all of these things fit together inside of a single config file
Scott Tolinski
services. In fact, when I press deploy on what I'm working with, it modifies, like, in ClickOps here Wes I'm pasting it into this UI. I only have one single environment variable even though I'm using a ton of them, and I'll show you a little bit why in in just a second here. But this is the GUI for it all, and it's fantastic. And, they've done a really great job with this.
Wes Bos
servers and image storage and all that stuff? like, when you think about all the different little services that they provide.
Scott Tolinski
or Pulumi, I believe it's called. If I pronounce that wrong, you can correct me.
Wes Bos
something like AWS, but it's just not worth
Scott Tolinski
Terraform year, and I'm not even halfway through it. It makes it super expensive in Canada. It's, like, 45 or so. Jeez. Oh my god.
Wes Bos
a way to
Wes Bos
so much more mature and and, like, obviously, very usable right now. And this is this is awesome because, like, a lot of people do wanna be able to deploy to
Scott Tolinski
Yes. That's correct. In fact, Okay. Yeah. I mean, it's it's all messed up. Sanity are are you using here?
Scott Tolinski
therefore, Terraform ideas. It it's able to create all of those things behind the scenes.
Dev environment runs services like database and functions
Wes Bos
Scott has a terminal running, and it's like this little GUI
Wes Bos
flight control.
Scott Tolinski
auto scaling or any of that stuff inside of here. Not something I've Deno. But Yeah. Your entire infrastructure is defined in here to the point where you're only really getting into the AWS console to set up user accounts and I'm rules and stuff like that.
Wes Bos
And you're you're clicking on other things like,
Wes Bos
doable in here? I would imagine. Right?
Wes Bos
in the terminal,
Wes Bos
and it JS absolutely wild, the stuff that he's talking about. And he was, like, kind of explaining of Terraform and Pulumi?
Wes Bos
he's, like, really into, like, Kubernetes.
Wes Bos
architecture of the Kubernetes
Wes Bos
them as well? What is Yeah. You can click on it. Can you is can you click on things in the terminal?
Wes Bos
with TypeScript files,
Scott Tolinski
Yeah. Yeah. There's all kinds of you can you can configure literally everything about your your hosting. And and I've I've only ever deployed to AWS with this, so I don't know what it's like in other platforms.
Wes Bos
what happens when the resources start to get limited. Right? We had,
Wes Bos
And but with your own Probably, like, two years ago just when this thing was just kicking off. And it seems part of what they did is you would just create a initial
Wes Bos
how to handle the different traffic spikes. Is is that something that's You're saying it gives you email. Is does that mean it just simply gives you, like, SMTP credentials? Or, like, And,
Wes Bos
And he does all of that
Scott Tolinski
it wouldn't be too difficult to set up, Yeah. No kidding.
Wes Bos
David Flanagan on Node seven forty six, and he talked about something's kinda similar to this, where
Wes Bos
really cool. I I imagine that would be really handy for,
Wes Bos
scaling up and and being able to I'm trying to, like like, compare this against,
Wes Bos
define
SST config sets up PostgreSQL database
Scott Tolinski
I pass it in load balancer things, and then I even define a domain for it. I'll talk a little bit more about domains and how that all works in just a little bit. And then I give it some e n v variables, and that gets my zero server sync container setup.
Scott Tolinski
I give it a dev command.
Scott Tolinski
that's not your production. I wanted a local database here that I could, like, goof with and make sure I'm doing things correct. And we'll talk about this this interpolate in a little bit so we can ignore that. We'll talk about the secret in a little bit. I just wanna show you all the services I have. We also have my zero sync service, which we talked about as being a Docker container. So I use the cluster add service. I give it an image.
Scott Tolinski
but this is it. It's essentially three lines of code where you just define SST AWS email, give it a name for the service, give it a sender, bingo, bingo. Now you Scott email in your app.
Scott Tolinski
Here, I'm creating a database.
Scott Tolinski
their Postgres helper here, which is just oh, dear gosh. What is the database service? It's so funny. I've been running through these acronyms in my Wes. RDS. My god. I'm so close to all this stuff, and I've been in it for so deep. It's it's all just cycling in my brain. So either way, I'm creating an RDS database with this Postgres helper, naming the database, passing ESLint my virtual private cloud, giving it a name. I do have some additional, like you typically connect things. And then now that I moved this to SST, Here's where the good stuff starts. So I have a VPC configuration. I'm creating my own virtual private cloud. Right? You could think of a virtual private cloud as being like a this is an AWS thing, but you could think of it as being like a a a grouping of related services that need to talk to each other, but privately.
Scott Tolinski
It's going to connect to a remote AWS, not great you know, like, Warp has really good click functionality. Ghosty doesn't. It has, like, not so whatever he built this in, you can you can click in this. So Cool. So either way, yeah, I got all my dev services up. I mean, it's like you don't have to worry about, like it's like running all your services like you would if you were using something like Docker. Right? Here's my app. It's up and running right here. So pretty nice.
Scott Tolinski
transform parameters to do things like logical replication that I need for Xero. I got all this config straight out of Xero, so you typically wouldn't have to do any of that stuff. And then I can even pass it in my dev dev information. So in a dev thing, what this is going to do is it's not going to connect out to AWS for this database. It's just going to when I'm in my development environment, it's going to utilize
Wes Bos
connect to remote?
Scott Tolinski
So I'm using, same thing. Well, like I said, it didn't do the same thing right now. I had to do some click ops for that. But, like, for my domains, for whatever it was, my subdomains or normal domains, it took care of all that for me. And I gotta say that's pretty dope. I didn't have to think about it. It just created this domain record for me, and I went there. And at some ESLint, when I was getting this going because I I I didn't wanna take Habit Path offline while I was working on this, I had another domain pointing to it. And it was easy as just changing this domain here. Next thing you know, it's working. Scott
Scott Tolinski
Next, I am having an email service. So it's simple email service. Again, this this gets it all all going. That's it. This is the only line I Node, and now I have email ready. Now granted, I had to get the email approved. I had to apply for things on Amazon's dashboard,
Wes Bos
the local Your your local those guys. Yeah. Yes. Oh, that's cool. And and you can, like, turn that on and off? Like, if you don't provide a dev, then it's just gonna
Many providers work with SST like AWS, Cloudflare, Stripe
Scott Tolinski
in the past week than anything else. I actually I think I I had a Google one time that was like, should I do this with my VPC and r or, you know, RDS to s three to e c two? Like, it was just like speaking another language. It's ridiculous.
Scott Tolinski
And I moved a site from, one service to another service, and I had my database over on Neon, and I had my UI over here. And it was all connected
SES provides email sending credentials
Scott Tolinski
Yeah. And then so, also, you can do CloudFlare stuff with this too, k v d Node, workers bucket, production user and a staging user. I'm also using CloudFlare, and I'm able to run some commands. I'm choosing what region it is, and I'm just declaring that it's a an AWS, a ton of stuff.
Scott Tolinski
And helps us get out there. So thank you so much.
Wes Bos
it's not setting up any sort of, like, client to actually send the emails. Right? It's just the the actual connection to it.
Scott Tolinski
email, remix, shell, and then you have access, like, shell access to your database that I could run PG restore and stuff like that on my database SST config file. It's pretty big. This file could be really just as small as a website if you just had this one SvelteKit thing and that's it. Right?
Scott Tolinski
Let's talk a little bit about Yeah. And it's hitting a four zero four and giving me an error. So, that's, like, kinda funny. You get, things like that. You can get the UIs for your updates. You can check your deploys. And as far as auto deploying go and things like that, you can connect it directly to a GitHub repo. So I do have mine connected to my GitHub repo, and I do have auto deploy. So anytime I push to a specific branch, DrizzleKit Studio in my dev environment as well.
Scott Tolinski
Svelte, Drizzle, Prisma, and Next. Js, Analog. I mean, I just keep going. There's they they have docs for everything on here. They knocked this out of the park, these docs. So there's an endless amount of Vercel, especially for, like, getting started. But if you really get into the components, this is where things get nuts. So if you click on components and then AWS on their doc site, it can do anything. You know, EFS, BUS, VPC, task, cron, auth, NUCs. I mean, it can do everything. Oh, man. It's yeah. So Chapstick ever in my entire life.
Scott Tolinski
your SST config. Again, it's your entire infrastructure. It's it's pretty incredible.
Scott Tolinski
Yeah. It's it's based on I think it's built using Pulumi, which uses the Terraform spec. Man, I am, like, not the right person
Scott Tolinski
directly from your SST config.
Scott Tolinski
experience here whatever. This is the cluster. Either way, scaling is okay. I I I gotta actually put it somewhere where it's gonna be more performant everywhere. So, yeah, I went and we need to have that. Excuse to to learn how to deploy to AWS? So
Scott Tolinski
my HabitPath Postgres, and my HabitPath SvelteKit adapter. And it has all this stuff up and running. And at this point, I can just load up my system.
Scott Tolinski
Because SST, we've talked a lot about it as infrastructure as code. Right? But there's also runtime code associated with SST.
Scott Tolinski
any runtime code to send email from SST or AWS. I am just using the SMTP credentials.
Scott Tolinski
But many times what you're doing is in your runtime code, you're actually pulling in your, SST resources to pull out all of the values out of it and then turn it into a connection string if I need it, which I did because I I do use environment variables in my code. And then later on, let's say, Yeah. Well, I got all those answers in one. Alright.
Wes Bos
a of a service. It's just it's so huge,
Scott Tolinski
to essentially configure your infrastructure. You can even create things like Stripe products I have my databases and oh, man. What are all of the different services called? I I tell I tell you, I've been learning more three letter acronyms In the past, I had this replication manager from the Deno sync docs. And, yeah, you're giving it the the CPU and the memory and all that stuff. But I would have to imagine, My name is Scott.
Wes Bos
But, you know, it can also be big and host a ass ton of stuff. That's for sure. That's good. And there's there's probably parts of SSD that you you didn't use as well. Right? Like, you mentioned s three.
Scott Tolinski
it uses
Wes Bos
services
Scott Tolinski
It is
Scott Tolinski
So it's not just AWS. It's not just Cloudflare.
Scott Tolinski
my zero sync server. You can see it's up and running. My functions are up and running. It has my Drizzle Kit Studio. You can see it has the tunneling here, HabitPath, just because this warp you through it. And you should, like, click here, do this, whatever, and you're all set up. Mhmm. One thing that I I didn't mention that I I do wanna say is really dope about this, Wes, is that
Scott Tolinski
because the dev mode is something that you can run. And, in fact, let me pop up in my term. Okay. So we run for me, it's p n p m s s t dev, but it's typically just s s t dev. And you can see that it tells me my app, and it does all this stuff automatically. It's giving me my, But, hey, before we do that, let's talk about Century real quick because let me tell you, with SST. And let me tell you,
Scott Tolinski
or using AWS specific packages to connect to your SST resources to then send the email. So that way everything stays really, like, tight. Right? I didn't wanna do that for a number of reasons, so I'm just using SMTP. But, yes, you can get in runtime as well. The website is just using the SvelteKit adapter. There's adapters for everything, which I'll show you in a bit. But we do this neat thing where we're linking a database. We add our VPC. I give it a domain, and then that is that. And then there's a little dev command that can run as well that just runs,
Wes Bos
Oh, no. No. I didn't. That's what I'm saying. AWS, and then internal is when exposing things to the Internet.
Wes Bos
just AWS alone, there's 39 different Maybe even more than that. Like services. I counted them. So there is 39. Did you count the ones under internal as well?
Scott Tolinski
providers that work with SST.
Wes Bos
oh, man. Yeah. Yeah. Man, AWS is just what a huge freaking cache rules. Mhmm.
Scott Tolinski
the developer
Scott Tolinski
more than, what, a 50 other ones. In fact, there's a whole directory of different providers that you can use, SST as a platform using Palomi and,
Scott Tolinski
to get deep into that because Yeah. I I'm so new to some of this stuff. But when I was looking at it, It's pretty insane. Yeah. That's because this is my, subscribers. So if if you wanna see, just click that subscribe button. Follow, like, all that kind of stuff. Pro at it. Yeah.
Scott Tolinski
endless amounts of things.
Scott Tolinski
So you can think of AWS as one provider. You could think of as Cloudflare as another provider, and then there is
Infrastructure as code allows complex architectures
Wes Bos
grab a set of these. They're, like, I don't know, $510 that you pay for, it's quite amazing that, like,
Wes Bos
two pieces of, like, teak wood,
Wes Bos
No. Although, you could. I'm sure you could do that. So what it is is it's actually a picture frame. Oh, yes. Yes. Yes. Yes. Picture frames are one of the most obnoxious things in the world because they're either
Wes Bos
it looks really nice to have them in all the different colors, like a black one, a white one. This my we got the teak version that looks best with our house.
Scott Tolinski
So shout out to the, everybody involved in SST, DAX, and, you know, anybody who's working on this. Also, what's interesting, Wes, is I don't know if they're currently using this, but in the console of SST, they're either going to or currently using Wes, do you have any sick picks or shameless plugs today for us? I do.
Scott Tolinski
Yeah. And just share share if you like any of our videos, make sure you like them, share them, all that stuff. It just helps us, and because of that, there's, like, a ton of stuff. But even, like, as far as, like, the UI stuff, like, let's say Wes had the SvelteKit site, they have getting started docs for BUN, NUC, Solid, Auth, Deno, tRPC, HONO, Astro,
Wes Bos
Right on. Well, thanks for laying it down. I'm certainly gonna give that a shot, on my next project because I think it'd be kinda neat
Scott Tolinski
it's pretty sick. Yeah. That's sweet.
Scott Tolinski
Shameless plug. I'm gonna shamelessly plug the Syntax YouTube channel, obviously. I'm gonna do a video on SST config in in dev here. So if you are interested in seeing some of this more in action in, like, Node site here I guess it's a Lambda. It's not a server. If I wanted to access my database resource, I have to link it. So anytime you have a resource that you wanna make available in another resource, in my config, I just specify a domain property. I give it my domain Node.
Scott Tolinski
And I, yeah, I hate the Chapstick. You gotta put your finger on whatever, but I'm I'm doing it for this because it works so dang well. And I'd used Aquaphor before for, like, you know, like, tattoo healing and stuff like that. But, man, best ChapStick around, and this stuff rules. I think, like, I've never had a more healthy skin since I I've moved here with this stuff. So shout out to shout out to Aquaphor. Right? Yeah. It's it's good stuff. We're we found a
Wes Bos
Can you guess what it is? It's two pieces of wood us lowly and then that service connects to your own AWS account. That service has, like, a GUI, and you can hook it up to Git, and it will deploy. And you can you can use it for,
Scott Tolinski
Yeah. Yeah. Big, big fan. So, yeah, that's all I got. Any any other questions, or are you you good? That's it.
Scott Tolinski
Deno sync. I think they were using Replicash before.
Wes Bos
It's right here. These are something that my wife found, and I think it's really cool.
Wes Bos
And you can get them in different lengths. You can cut them down to the actual size Right? But, like, what other
Wes Bos
Alright. Thanks for tuning in. Catch you later. Peace.
Scott Tolinski
Smash that subscribe button. Wes and I and CJ are all going to switch to Neovim
Scott Tolinski
So I'm deploying a zero sync app in a console that's built with zero sync, and, asking about. So within this, you can see all of the services that you're using. And if you've ever been, like, you know, how how many things JS this actually configuring and using? I mean, just, like, scroll through all of this stuff. And this is all of the stuff this is having to deal with and configure. It's or, you know,
Wes Bos
and then you you've got this nice oh, I just I just,
Wes Bos
or something like that.
Wes Bos
to deploy it like this.
Wes Bos
broke it. Oh, no. No. I didn't. It didn't I didn't break it. It goes through the thing. That's great. I'm glad you didn't break it, honestly. I'm super glad. But it like, if you've got, like, a a nice photo you wanna hang up or whatever and you don't feel like going the whole route of a regular picture frame,
Scott Tolinski
I started using Aquaphor Healing Ointment Advanced Therapy. And it's like a a balm, but it's it's essentially there's not just that, Wes. There's a 50 And, I'd let me tell you, Wes, I needed it because
Wes Bos
and they connect to each other with magnets.
Wes Bos
Yeah. 15 is not bad at all, though. That'll last forever. Yeah. Yeah. Cool. Yeah. Okay. Shout out to Aquaphor.
Scott Tolinski
Cool. Well, let's get into sick picks and shameless plugs, things that we like that are sick, things that we wanna plug that are shameless.
Wes Bos
small version of it as well when we were in The States
Scott Tolinski
Yeah. For this this big ass tub, a 14 ounce jar, it's, 15.
Scott Tolinski
connect with magnets. Is it for drying things? I'm,
Scott Tolinski
the moment we hit 500,000
Scott Tolinski
youtube.com/addsyntaxfm.
Wes Bos
that where he's switching between all of these different resources.
Wes Bos
of
Scott Tolinski
But I I've bought one jar of this in the past Every single one of these little things is a resource. So So, like, Either way, my name is Scott Tolinski. I'm a developer from Denver. With me, as always, is Wes Bos. What's up, Wes? Hey. Yeah. This this sounds exciting. We had DAX on a long time ago. Yes.
Scott Tolinski
sneak peek something kind of off board here. In Colorado Wes, it's so dry here. It's so dry. I have not been able to get a handle on, like, you know, like, ChapStick. I'm putting ChapStick on, like, every three seconds. My skin is super dry. And nothing I found that has been very good for that until,
Wes Bos
the worst quality ever, like, even the IKEA picture frames have gotten so awful over the years, or it Scott a million dollars to frame something. And and sometimes you just have something that's nice that you wanna hang up.
Wes Bos
And my wife found these, where it's
SST similar to Kubernetes config with TypeScript
Wes Bos
databases, job scheduling,
Wes Bos
And what you're scrolling through right now is a list of all the resources that are used. And these seem like
Scott Tolinski
So,
Scott Tolinski
defined in, like,
Scott Tolinski
it does do an auto deploy for me, without issue. And one of the cool things that we haven't necessarily talked about is environment variables and how you connect your app and all those kinds of ways. It ends up being really nice and simple to the point where I only have one environment variable a thing you can set up to be, you know, auto scaling, give it min and max values for things Okay. Memory utilization, that kind of stuff. So, yeah, you can set up auto scaling directly. 50% CPU, it scales up another one to a maximum of however many you've set.
Wes Bos
active resources
Wes Bos
So the pricing is the picture that you're hanging. And you just put one at the top and one at the bottom,
Scott Tolinski
like, what's it called, CDNs and all that stuff for you with CloudFront.
Scott Tolinski
So this is everything that I'm using just for that one app, which is why AWS is tough. And it it's neat. So you get all kinds of things. You get logs,
Scott Tolinski
Yep. This is, like, Cloudflare's own lookup.
Scott Tolinski
Let me pull up my SST console.
Scott Tolinski
Yeah. So that that brings it's a good time to bring in the the console here. So, like you mentioned, like, what is the GUI for this type of thing? You you get access to this. Now this does become a paid product at some point.
Wes Bos
That's a SSL certificate.
Scott Tolinski
clearly, like, when you have this, you know, it sets you up with, local first platform.
Wes Bos
Yeah. What's the approach to that?
Scott Tolinski
yeah. I I don't even know what half this stuff JS. If I'm being entirely honest, I'm so I'm such an s s or I'm such an AWS Node. SK CDN SSL.
Wes Bos
based on So anything
Wes Bos
active resources.
Wes Bos
for for your app here?
Wes Bos
Wes, like like, what's what's a resource?
Wes Bos
it's a service not worth the the pain of of having to do that type of thing. So, like, SST is That's dope.
Wes Bos
AWS Lambda. You can use it for
Scott Tolinski
VPC.
Scott Tolinski
You get issues, actually, which are interesting. It's kind of like a, Century mini. You can see I need clearly need a four zero four page because,
Scott Tolinski
on my site right now. The bottom
Scott Tolinski
in addition to your your your scaling question, Wes, yes. Yeah. There is I just was on the, this is the v So many resources,
Wes Bos
background workers, things like that. It's it's just for AWS. It kinda gives you that, like, Vercel experience, is charged at 8.6ยข
Wes Bos
anything over 350
Scott Tolinski
a lot of people are looking for WP login
Wes Bos
like functions or just like like, helpers? They're, like, for Microservices Vercel. Right? Pieces?
Scott Tolinski
Yeah. You you mean, like, in terms of, like, what am I actually deploying right now? What's the GUI for that look like? Yeah. Yeah. And my other question to that is is is there also, And remember, my SST config had a dev database and it had a production Node. So I don't have to fuss with a dev e n v and a production e n v. It's just gonna use my dev database and my local one. And, likewise, if I want to pull from a dot e n v, I can just use process dot e n v in this file, and it will pull directly from my dot e n v. But, again, like, other things can come directly from that, like, secret value I created. You can do just straight up JavaScript in here. So I can say, oh, hey. For my sync server, when I'm in production, use the service URL that it created. But in in local, use the local host URL.
Wes Bos
like, a, like, a CI built into this? We had them on the podcast as Wes, where flight control is like a
Scott Tolinski
pretty mammoth. Right? an email service with was it
Wes Bos
per resource. So what how many resources do you have monster of
Wes Bos
with your own AWS account. Does Yeah. SST have something like this as well? Like, if you wanna, like, say, okay. What am I using? like it is,
Scott moved HabitPath app to AWS for better performance
Scott Tolinski
for zero schema. So I'm doing all of that just in straight up JavaScript, reading a file and loading it into an environment variable. So we can ignore that because it's not SST related.
Scott Tolinski
I'm I'm hosting It could be that small.
Wes Bos
Yeah. Yeah. I've moved it all to AWS. On?
Scott Tolinski
one cool thing about this config is that it's TypeScript. It's a TypeScript file. So I can do but not that many.
Scott Tolinski
I did have an s three bucket in here for for database backup or replica backups at some point. I'm not doing that anymore. It was too complex for for me when I was getting started. The zero schema thing, that is a
Scott Tolinski
and I'm passing in my virtual private cloud. I'm giving it some just, like, additional settings, which are not things we need to worry about here. But so you create the cluster. You create the VPC.
Scott Tolinski
And some of these services can become public, but, like, things like your database or, you know, the sync server. I don't necessarily want those to be, public in that way Wes I want the the UI to be able to connect to them. Right? But Mhmm. I don't I don't want users outside of my VPC to connect to the database. Got it. So you have your own virtual private cloud, so you create that. Then you, in this case, for my container, for my Deno sync stuff, I am creating an an ECS cluster, AWS, Cloudflare, these types of things with something called SST.
Scott Tolinski
simple email service or something? I don't know. All that happens too. Yeah. SES is simple email service. Yep. Correct. Okay. So I'm hosting email with SES. I'm hosting my sync server for my Deno, and you're able to use it, pass it into your app, all that stuff. But there's also, like, more, like, runtime code stuff. And I didn't use a whole lot of this, so I'm just gonna paste this down here for people who are watching.
Scott Tolinski
Even though it was a user error on my part, I was like, I'm gonna see if I can dive into AWS's dashboards and figure out what I did wrong here Yeah. Or, like, open up groups or try to route things. And it's like, the end of the day, I needed to nuke my SST config and start over because I was just too green. I I didn't know what I was doing enough. So, yeah, we'll talk a little bit all about that. So either way, you define all of the services in your app in a single config. And I'll show you my config here. And this config file can be very big. It can be very small depending on how many services you have. And I'll collapse some of this stuff so you can see what's important here. For this config, I am hosting a number of things. The config that is on the screen right now. I'm not gonna explain the code too much, it's essentially petroleum jelly, but, like, with several other things, like, I believe, like, lanolin or some other stuff in here. Yeah. We slap that on our kids' butts, and we're we're we buy the huge ones of that. I buy the huge one. Yeah. I buy the huge one. And and this is, like, the best thing I've ever had It's amazing.
Scott Tolinski
So, like, I can have totally separate production and and staging infrastructure.
Scott Tolinski
But the the nice thing about that is is that you don't have to go through in what they call click ops and click here and click there. And let me tell you, on AWS dashboard, there's just about 800,000,000,000 things to click on. So that was the hardest part for me was, like, when I was, like, trying to figure out what was going wrong. I was like, alright. Now I gotta click through these dashboards.
Scott Tolinski
So the first first part about it here is we have our app config. Inside of our app config, you just give your app a name.
Scott Tolinski
Totally. So, okay. Let's let's talk about it. We mentioned it's SST is infrastructure as code. Again, you're writing your code to define your infrastructure. That's pretty self explanatory.
Wes Bos
Coolify.
Wes Bos
like a like a Linux image, or or how does that run? Yeah. It's a Docker container.
Scott Tolinski
That's kinda my whole job JS, finding excuses to to, on SST, Pulumi, which I have my, like, auth secret, and that auth secret is defined as an SST secret. Now I set this via the command line once, and then I'm able to access this auth secret just with a, a new SST auth secret. Right? I'm able to access that in my infrastructure.
Scott Tolinski
I am hosting a UI with Lambda via the SvelteKit Lambda adapter.
Wes Bos
f with things. Yeah. And it to totally rip everything out, redo it, hit all the problems along the way.
Scott Tolinski
provider that I'm using for for many of these things. And then you have essentially, a run function in your config. And this run function is where you define all of your different services.
Forgetting Cloudflare cache rules only remaining manual step
Wes Bos
one little thing. Like, ah, that that's still a click click ops thing right now. Like, right right now, I have,
Wes Bos
yeah. I always love that because there's always That is at, I think, CVS or something like that. And it's it's like a a mini one we can kinda just keep in in the diaper bag, and you don't have to bring the huge one around. So it's it's expensive stuff, but, man, it's awesome.
Scott Tolinski
that's where this comes into play here. So if I wanted to access the database credentials straight up JavaScript in here. So for instance, I needed to load a JSON file and pass it into pnpm n v variable It is. And I I feel very powerful with this because I feel like So this is really kind of the backbone for a lot of this stuff, and it's why it all works as infrastructure as code. And it's a cool project. I didn't really know anything about it. I heard of Terraform, obviously, but not Pulumi.
Wes Bos
And the cache rules are done via the GUI in the,
Scott Tolinski
I don't wanna do this. Like,
Wes Bos
JavaScript developers can now,
Wes Bos
one little piece where you accidentally forget
Scott Tolinski
every every everything I I wanted out of it is just like, I don't I don't feel the need for it anymore. So Well, there's a reason why that's So staging and production accounts, create all these different I'm credentials and interfaces and stuff like that. You create all of these things, and these docs walk you through it. They hold your hand like I'm holding my daughter's hand crossing the street. It is like I feel so secure reading these docs because everywhere it tells me to click. I click these darn things, and they're there. I don't know how many times that, like, happened to you where it's like, click the, getting started button, and there's no getting started button. So Oh, yeah. Yeah. Shout out to, everyone involved in these docs because they're fantastic, and they will walk you through all of this stuff. On that kind of same idea, I remember Wes had Brian LaRue on. He was working on begin.
Wes Bos
dashboard. And I'm sure you can, Vercel, like, using a a platform as a service, you're probably looking at at hundreds. Right? That's always the trade off with using AWS. Right? It's hard, but it's much cheaper.
Scott Tolinski
you just link it, and that's it. So pretty nice and simple. Works super well. I I've no issues with that whatsoever. And, yeah, I gotta say, for somebody who's avoided infrastructure as code mostly because you go to you you you think, like, this is a good idea. Right? This this sounds like a good idea. I'm sold on it. And you go to Terraform's docs, and you're just like, There it sets you up with,
Wes Bos
like, architect some major infrastructure.
Wes Bos
and that would be kind of Node. But, like, I I didn't feel like diving into it. But I know that when I go to move it to the production domain name, I'm gonna forget.
Wes Bos
like, infrastructure is an entire career in itself. Right? Just just doing all this stuff. And
Wes Bos
like, do something like this Wes you can you can replicate it in code,
Tunneling provides access to private production resources
Scott Tolinski
I feel like I could do this. Maybe I'll actually have a YouTube video. Yeah. I think that's a good idea, to put out a YouTube video at the same time we release this that shows you maybe walking through some of this stuff. But I will say that the the developer docs for SST, Well, we'll talk about that.
Scott Tolinski
while connecting to the production one without having to expose
Scott Tolinski
Which which freaks me out. Right? If you click those buttons, it's like, make this public and, have no IP restrictions and stuff like that, and it should freak you out. But it freaks me out. So, being able to tunnel into that is is super nice. Cautious amount or a healthy amount of caution is always good when all of that stuff. You can do Welcome to Syntax.
Scott Tolinski
for everybody involved in creating these docs because they are good. They're very good. And they walk you through not only, like, things you might want to do, but I gotta say, Oh, man. That's a great question.
Scott Tolinski
I I pass it my IP to approve my IP, and then I can connect to it from my local one and, you know, make sure that the migrations I did or whatever is the data is where it's supposed to be. And I had such a problem with that, Wes. I had such a problem with, with the private resources and a VPC. Like, how the hell do I connect to this stuff? How do I make sure the data's there? And what I was able to do was I was able to do hosting that with an e c two cluster.
Scott Tolinski
to create management accounts, create,
Scott Tolinski
as somebody who's an AWS noob, when I went to the how to setting up your AWS accounts and it tells you credentials, right, or the email credentials or those types of things because they're being defined as the infrastructure. So you can use SST in runtime as Wes. So it's not just, like, config and let it rip. You know?
Scott Tolinski
that production database Now I'm not using to the general public. Yeah. Yeah.
Scott Tolinski
the biggest round of applause,
Scott Tolinski
But, yeah, this is this is SST. And you know what? It it is one thing I gotta say, if you're if you're, like, watching this and you're like, this all looks interesting to me, I gave it my CloudFlare ESLint but Yeah. So it it's really pretty Scott. And Wes did mention, like, the tunneling aspect, but, like, one thing that I had a big problem with, me personally, I'm so used to having, like, oh, I just have a connection string for my database.
Begin creates initial IAM access then configures resources
Wes Bos
IAM I'm working with my CloudFlare
Wes Bos
And
Scott Tolinski
an environment variable, my CloudFlare API keys and stuff. Yeah. And by doing that,
Scott Tolinski
Mhmm. And then you give it that, and then it goes and and creates all the stuff for you. Does that work the same does this work the same way? I you know, I'm not I'm not gonna say yes to that because I don't think so. Okay. And the way I did is I did have to create all the I'm identity center stuff. I had to do all that. I I don't know if this does that, and it might.
Wes Bos
that had access to everything.
Scott Tolinski
this goes through Cloudflare and updates your DNS, You can give it different stages.
Scott Tolinski
for everything, for subdomains, for domains, updates your DNS, gets all the everything going for you. And it did also the same,
Century monitors app errors during infrastructure changes
Scott Tolinski
sign up and get two months for free using the coupon code Sanity treat.
Scott Tolinski
So if you're moving all that kind of stuff around, you're getting into Vercel, or perhaps there's now private services in your own virtual private cloud that you need to connect and things aren't connecting, you wanna make sure that you keep on top of all of that stuff. So use a service like Sanity at sentry.i0/syntax, I've been deploying things like I said, you know, I typically, me, personally, we've talked about hosting databases and stuff like that. I you know, I'm I'm opting to use something like PlanetScale or Neon on the server of my SvelteKit, so Pulumi is infrastructure as code in any programming language. It's an open source project, and SST uses all of this open source stuff.
Scott Tolinski
I I'm deploying an app that people are actually using. I have, like, 800 users on this app, and I need to make sure that these users know if this thing is or I need to make I need to know if if the app is breaking any kind of way, especially when you do such a major architectural change to this thing. Yeah. And this is your your HabitPath app? do they have? Let's take a look at the docs. Well, let me tell you, Wes. The answer is that it's pretty much endless. And, it's crazy because this uses Terraform, So that way, I can manage all of that with only, like, completely separated This is whatever this is, Wes, I don't know what what this is. And it's not ghosty because ghosty has