Easily Deploy Full Stack Node.js Apps on AWS EC2 | Step-by-Step Tutorial

  Рет қаралды 34,759

Sam Meech-Ward

Sam Meech-Ward

Күн бұрын

Learn to deploy a Node.js or Bun app connected to a PostgreSQL or MySQL database on AWS EC2 Ubuntu Instance. This video covers the setup of a continuous background run for the app using SystemD, and setting up a reverse proxy with Caddy for handling HTTP requests and SSL certificates. Finally, I show how to configure a custom domain with AWS Route 53 for easy access and SSL security.
Chapters:
0:00​ Setup EC2
3:10 Connect using SSH
4:55 Update Ubuntu
6:06 Install Node/bun
7:26 rsync code to server
10:25 Run Node.js App
12:40 Modify Security Group
14:18 Install Postgres/MySQL
17:47 systemd
22:56 Caddy server/reverse proxy
25:35 DNS & SSL
28:09 Summary
Help support me make more videos: ko-fi.com/meechward
🔗 Code Snippets: www.sammeechward.com/deployin...
🔗Moar Links
My Website: www.sammeechward.com
Instagram: / meech_ward
TikTok: / meech.s.ward
X: / meech_ward
Threads: www.threads.net/@meech_ward
Github: github.com/orgs/meech-ward

Пікірлер: 106
@nasrularif9570
@nasrularif9570 2 ай бұрын
Finally a video from A to Z... Most video of AWS tutorial I found start from Y to Z...
@and_ppv
@and_ppv 3 ай бұрын
Stumbled upon the video, and watched the whole thing - at normal speed and rewinding along the way. Great material
@TimothyHuey
@TimothyHuey 23 күн бұрын
Your video was very well done. I was able to deploy a nodejs webapp on my first attempt. Your 30 minute video took me about 7 hours to complete and I was filled with dread when you said at the end that you had a short 7 minute video explaining how to buy a domain name. I knew that was gonna take me 30 mins to an hour. But time is not an issue, understanding is, when it's your first time. I invested the time to thoroughly understand your instructions and deploy the app. It went off well and my app is up now and ready to be tested by users. Well done!!!!
@ScriptCodec
@ScriptCodec 2 ай бұрын
Ive been waiting all my life to understand what my boss had me do my computer via Google cloud run 😅. This is a hrll of a revision. thanks man.
@astronautonmars
@astronautonmars 3 ай бұрын
Your videos are always straightforward and I absolutely love them 🥰
@cashamigos
@cashamigos Ай бұрын
this is exactly what I was looking for. After taking notes I am excited to practice this many times to ensure foundational knowledge. Awesome stuff!!
@tualgorithm
@tualgorithm 3 ай бұрын
Man, this is the greatest tutorial video that I've ever seen!
@SamMeechWard
@SamMeechWard 3 ай бұрын
Thank you 🤗
@yanfung9081
@yanfung9081 3 ай бұрын
You always deliver an amazing KZbin tutorial for the viewers! Your explanations are always spot on! Thank you so much!!! :)
@AlfredoGuako
@AlfredoGuako Ай бұрын
this was incredibly helpful, got my first custom domain web app running!
@bigbadcatbigbcy2933
@bigbadcatbigbcy2933 20 күн бұрын
Thank yo so much for this tutorial. This is the only working tutorial in the internet and explains everything so good and it only takes 28 minutes
@devaa7076
@devaa7076 3 ай бұрын
Woahhh...Woahhhh. What a great tutorial sir!. I was thinking to learn how to host a server in cloud and what is ssh what is reverse proxy how to map domain name to our server...like man i got all the answers in a single 30min video. Thank you so much for producing these high quality videos and keep on doing em! Hats-off.
@Beyram1501
@Beyram1501 2 ай бұрын
Man your videos are amazing and really clear. you gained a subscriber. Thanks
@user-iz2ge2fl4x
@user-iz2ge2fl4x 27 күн бұрын
Thanks so much, your way of teaching makes things simpler. Waiting for more videos 💫
@armaandhanji7151
@armaandhanji7151 3 ай бұрын
Fantastic walkthrough!
@SamMeechWard
@SamMeechWard 3 ай бұрын
Fantastic comment!
@ecko3383
@ecko3383 Ай бұрын
You are incredible kind sir. Thank you for this
@bigbrain720
@bigbrain720 9 күн бұрын
broooo this video is so solid
@manuel.blanco
@manuel.blanco 21 күн бұрын
Thanks, this helped me a lot!!
@ImpendingSole13
@ImpendingSole13 2 ай бұрын
You're amazing. Thanks alot !!
@rangaswamireddy8683
@rangaswamireddy8683 3 ай бұрын
Fantastic the way you explained. And i request you make a tutorial on pm2 load balancer etc... thanks
@yemam4156
@yemam4156 8 сағат бұрын
Thanks bro a lot for this tutorial
@ShreyasSreedhar2
@ShreyasSreedhar2 16 күн бұрын
Super helpful, Thanks!
@khashe
@khashe 2 ай бұрын
This was really great.
@courtneynel7433
@courtneynel7433 Ай бұрын
This is a really great video.
@quangtranoannhat2930
@quangtranoannhat2930 3 ай бұрын
awesome !!! love this content
@SonAyoD
@SonAyoD 3 ай бұрын
Great plugins thanks!
@ustav_o
@ustav_o 4 күн бұрын
absolute legend
@Tubee1234
@Tubee1234 2 ай бұрын
really amazing tutorial
@ervispojana118
@ervispojana118 22 күн бұрын
Thank you !!!
@XavierTheRapper
@XavierTheRapper Ай бұрын
Dope!!!!!
@thequang9234
@thequang9234 3 ай бұрын
top notch content Sam! Would you care to explain what you meant by 'I have a migration system on my app". Why did you have to run npm run migrate? Thanks!
@solo-yl8uc
@solo-yl8uc Ай бұрын
thank you so much.
@anjanshomodder6463
@anjanshomodder6463 2 ай бұрын
Really helpful video. Would be nice if you could create a video about how to automate all these stuff with github actions. Thanks
@kjsharp
@kjsharp 2 ай бұрын
Fantastic video
@pruthveshshetkar1263
@pruthveshshetkar1263 27 күн бұрын
Thanks!
@erlend1587
@erlend1587 3 ай бұрын
Great tutorial! I did something similar using Linode, but used nginx instead of Caddy. Caddy seem like a simpler choice with the automated ssl.
@SamMeechWard
@SamMeechWard 3 ай бұрын
I only recently started using it, but it's been awesome and I trust the community behind it
@elitdesign3867
@elitdesign3867 3 ай бұрын
Awesome job! thank you. What about MongoDB and nginx, I hope you explain that someday. Another question, please: How can I get the client's IP (remote ip)?
@somnathgolui2912
@somnathgolui2912 2 ай бұрын
Great video! Can you also tell us how to do continuous delivery?
@AdarshMadrecha
@AdarshMadrecha 25 күн бұрын
Can you do a follow-up video, just covering changes required if using Bun instead of Node Js?
@dekooks1543
@dekooks1543 3 ай бұрын
banging video mate ! Do you mind if I ask what software you use to edit your videos ? The transitions and zoom effects are top class
@SamMeechWard
@SamMeechWard 3 ай бұрын
I use a few different pieces of software, but my main video editing is done in Camtasia. It's pretty easy to use and all the basics are covered in their intro 45 minute video: kzbin.info/www/bejne/d3aUeZmvYt6qatU
@MilindMishra
@MilindMishra 3 ай бұрын
quick question can we not add our git credentials to the server and then use them to pull changes and deploy from the server or if that is not a standard practice ?
@noahmilliken4259
@noahmilliken4259 3 ай бұрын
can anyone explain to me how the server file and the react app both run? I am having a lot of troulble starting my vite app in the front end directory and the server from the systemD command?
@sunilmaurya6594
@sunilmaurya6594 3 ай бұрын
Can u please make video on automatic things? Would be appreciated 🙏
@EmanuelCovelli
@EmanuelCovelli 15 күн бұрын
I really would like a similar tutorial that uses Docker on ec2
@charithlakshan8382
@charithlakshan8382 3 ай бұрын
this might be a dumb question. instead of copying your files from the local machine to the remote machine. you can install git on ec2 and pull from repo ?
@khaledsanny4817
@khaledsanny4817 3 ай бұрын
Yeah but it's too much hassle just for this video. You will have to create and delete the repo
@israelafangideh
@israelafangideh 3 ай бұрын
Yes, you can
@snakefinn
@snakefinn 2 ай бұрын
I imagine that there will be some files that won't be located on the repo you may want to copy over. For example .env files
@austinm8823
@austinm8823 25 күн бұрын
​@snakefinn but he didn't copy over the .env files using rsync either lol.
@switchlyrics.
@switchlyrics. 18 күн бұрын
imagine u lose ur git account
@andreabiaggi3198
@andreabiaggi3198 3 ай бұрын
Awesome job! Would be great to see how to move from this infrastructure to one more scalable, with a dedicated RDS instance, a load balancer and maybe different ec2 instances for different microservices, maybe using terraform. But as you said this is foundational and it's very well done!
@DheerajKumar-ik4mi
@DheerajKumar-ik4mi 2 ай бұрын
Have you put the frontend requests to localhost or a specific IP?
@lev1ato
@lev1ato 2 ай бұрын
Hi I just found your channel, I know you prob have many requests but if you can do video about Lucia auth, maybe with Turso again 😅
@HenryOsim
@HenryOsim 3 ай бұрын
great video thanks. Can you create a video about doing same with Terraform please?
@SamMeechWard
@SamMeechWard 3 ай бұрын
Thank you. That's a bit more of a challenge because terraform isn't really used for single instance configuration. You would end up using something like packer to create an ec2 image of the node app, then use terraform to create a new instance based on the image. Terraform is used for immutable infrastructure, which this is not. However, I do have a series of videos on how to use terraform and packer for this kind of stuff, but you'd end up with many ec2 instances instead of just one.
@WIBEDRILLMusic
@WIBEDRILLMusic 14 күн бұрын
Hi Sam, can you make one video for the Serverless approach??
@haha7836hahah
@haha7836hahah 3 ай бұрын
How can i setup the database so that it is in a private subnet and can be accessed only by the ec2 instances within my vpc
@lebronjaimeslannister
@lebronjaimeslannister 3 ай бұрын
thank you for the vid, would you explain how to protect ec2 against something like ddos? i’d like to try ec2 but in fear of overcharging by aws
@SamMeechWard
@SamMeechWard 3 ай бұрын
ddos wouldn't increase the cost of a single ec2 instance like this. It would grind your app to a halt, but no additional costs. I'm pretty sure all services, including ec2, are protected from basic ddos attacks with aws shield aws.amazon.com/shield/
@marvellousadesanya8480
@marvellousadesanya8480 2 ай бұрын
Any alternatives o rysnc? Does not work on git bash
@marioshadj8409
@marioshadj8409 3 ай бұрын
Thanks for the video! Can you make a video on how to handle new version of the app without downtime?
@SamMeechWard
@SamMeechWard 3 ай бұрын
With one server, you wold always experience some amount of downtime. It could be minimal though, just the amount of time it takes to restart caddy, so a few milliseconds. The only way I know of to get absolute 0 downtime is to use multiple ec2 instances with a load balancer, which is much more complex
@spare4337
@spare4337 2 ай бұрын
Can u create SSR on aws with React
@P.Shivakrishna
@P.Shivakrishna Ай бұрын
hey can you explain more about migrate postgres sql db into ec2 how to create migrate.ts file and other things
@bigdinorino
@bigdinorino 2 ай бұрын
at 9:56 how do you go to my app git(main)
@truth8690
@truth8690 3 ай бұрын
great
@SamMeechWard
@SamMeechWard 3 ай бұрын
Thanks for watching! I'm glad you enjoyed it.
@jitx2797
@jitx2797 3 ай бұрын
Wow this is good. I have questions and suggestion. Does that systemd replaces the use of pm2? Why didn't you use pm2 Suggestion: Moving forward with this with setting up basic testing and CI CD.
@KratosCY
@KratosCY Ай бұрын
Good question and suggestion.
@jitx2797
@jitx2797 Ай бұрын
I am currently using pm2...For CI CD I found this kzbin.info/www/bejne/nJzdoaytoa-Wg6M@@KratosCY
@programmer9809
@programmer9809 28 күн бұрын
👍
@UcheagwuOnyike
@UcheagwuOnyike 3 ай бұрын
Can you share the codebase? Would you like to do some practice? I can't find it on your Github
@martinoveer9483
@martinoveer9483 2 ай бұрын
OCD speed?
@rduballday
@rduballday 3 ай бұрын
Hello , can you point me to the code for this tutorial?
@MilindMishra
@MilindMishra 3 ай бұрын
Great work! but isnt pm2 a better practice instead of systemd ?
@MilindMishra
@MilindMishra 3 ай бұрын
latter in the video i understood the mindset of you teaching the basics first so it makes sense, thank you!
@Jeremiahking101
@Jeremiahking101 Ай бұрын
I have an App.js running on port 3000 and a Server.js (Backend) running on port 5000. How would this work?
@kincaidschmitt7811
@kincaidschmitt7811 Ай бұрын
+1
@vikneswaran6186
@vikneswaran6186 2 күн бұрын
I am assuming that you are having your app.js using server.js files , so that eventually it is able to connect to it how it connect on local computer , because you could see that it is still now being running on local host 3000 so that would be able to access the 5000 port server running on it .
@astb01
@astb01 3 ай бұрын
Wouldn’t it be easier to just dockerize the application and use docker compose on the ec2 instance by using ansible? Feel it would be much cleaner to build images and bundle them into a compose file 🤔
@SamMeechWard
@SamMeechWard 3 ай бұрын
Docker makes some things easier and some things more complex. My issue with docker is that there's a learning curve in the beginning, in order to use docker, you have to learn docker. And in the end, you still have to understand how VMs work. So I avoid using docker or teaching with docker, unless it's absolutely necessary.
@purplemoon-media
@purplemoon-media 2 ай бұрын
is it okey if I add source code via github ?
@amansagar4948
@amansagar4948 17 күн бұрын
12:32 i clicked the "open address" from AWS console rather than copying the address so it was opening the app in https not http and i was unable to access it. I was stuck on this for a day
@solo-yl8uc
@solo-yl8uc Ай бұрын
are these all free within free tier usage?
@abdulganiyuzziwa8555
@abdulganiyuzziwa8555 14 күн бұрын
😆😆Dude u actual have a DRIZZLE folder are you in the movement too🤣🤣🤣woow
@leanderchristmann2981
@leanderchristmann2981 2 ай бұрын
Note on 19:18 that if you installed Node.js differently, like via the NVM Node Version Manager, you have to set different ExecStart path in the .service file - or else you'll receive an error "Active: failed [...] Process: .... ExecStart=/usr/bin/node index.js (code=exited, status=203/EXEC)" when doing "sudo systemctl status myapp.service".
@ichigokuro3986
@ichigokuro3986 2 ай бұрын
what changes are to be made?
@ayushgursal1627
@ayushgursal1627 Ай бұрын
It asks for password if i do chmod 400 so what password should i write there for that instance
@phantazzor
@phantazzor 3 ай бұрын
can you migrate to t2.small later on ?
@SamMeechWard
@SamMeechWard 3 ай бұрын
Yes, you just have to stop the instance first.
@vernevens1598
@vernevens1598 Ай бұрын
We use AWS to insure more food shortages and plandemics.
@prayaspatel6325
@prayaspatel6325 2 ай бұрын
Don't mind me brother, you look something like Eliot Anderson
@yazanalzubi5446
@yazanalzubi5446 Ай бұрын
Do you have any courses that I can buy? Please take my money
@hotwings9382
@hotwings9382 26 күн бұрын
Couldn't this be done inside nginx?
@austinm8823
@austinm8823 25 күн бұрын
Did you watch the video? Honest question. He addresses that he normally would use Nginx.
@user-lx6lp3jg2c
@user-lx6lp3jg2c 2 ай бұрын
Please show the same detailed video, but deploy the finished project in Amplify + Lambda
@SamMeechWard
@SamMeechWard 19 күн бұрын
Honestly, I avoid amplify at all costs. My recommendation is to try SST.dev
@yiannis_p
@yiannis_p 2 ай бұрын
Yall never heard of git and docker ?
@canadahq6926
@canadahq6926 Ай бұрын
😂
@namesare4fools
@namesare4fools 3 ай бұрын
this is far from easily, why are you not using SST
@SamMeechWard
@SamMeechWard 19 күн бұрын
I love SST, when I want a serverless environment
I Stopped Using Express.js: Because Bun and Hono 🔥
10:23
Sam Meech-Ward
Рет қаралды 93 М.
MINHA IRMÃ MALVADA CONTRA O GADGET DE TREM DE DOMINÓ 😡 #ferramenta
00:40
Қайрат Нұртас & ИРИНА КАЙРАТОВНА - Түн
03:41
RAKHMONOV ENTERTAINMENT
Рет қаралды 296 М.
白天使和小丑帮助黑天使。#天使 #超人不会飞 #超人夫妇
00:42
Top 50+ AWS Services Explained in 10 Minutes
11:46
Fireship
Рет қаралды 1,4 МЛН
Deploy Next Js on Cloudflare
3:57
Sphorb
Рет қаралды 2,6 М.
AWS EC2 Auto Scaling : Step By Step Tutorial ( Part - 10)
30:50
Rahul Wagh
Рет қаралды 18 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 272 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 883 М.
Amazon EC2 - Elastic Cloud Server & Hosting with AWS
20:54
Piyush Garg
Рет қаралды 12 М.
Компьютер подписчику
0:40
Miracle
Рет қаралды 191 М.
Нужен ли робот пылесос?
0:54
Катя и Лайфхаки
Рет қаралды 849 М.
Broken Flex Repair #technology #mobilerepair
0:55
ideal institute aligarh
Рет қаралды 15 МЛН
КУПИЛ SAMSUNG GALAXY S24 ULTRA ЗА 88000 РУБЛЕЙ!
27:29
Which Phone Unlock Code Will You Choose? 🤔️
0:12
Game9bit
Рет қаралды 6 МЛН