Deploy Node app on AWS EC2 Amazon Linux 2

  Рет қаралды 83,250

Sam Meech-Ward

Sam Meech-Ward

Күн бұрын

Deploy Node app on AWS EC2 Amazon Linux 2 by installing node js and setting the app up as a systemd service
Code Examples:
sammeechward.com/deploy-node-...
Chapters:
0:00​ Intro
0:14 Setting up an EC2 Instance
2:31 Installing Node
3:21 git clone code onto the instance
4:28 Running the node app
6:13 Environment Variables
9:38 Systemd service
14:13 Summary
🔗Other tutorials:
MySQL on AWS EC2 Amazon Linux 2: • MySQL on AWS EC2 Amazo...
Nginx Reverse Proxy on AWS EC2 Amazon Linux 2: • Nginx Reverse Proxy on...
Setting Up And Deploying AWS EC2 Instances: • Setting Up And Deployi...
🔗Moar Links
My Website: www.sammeechward.com
Instagram: / meech_ward
Github: github.com/orgs/Sam-Meech-Ward

Пікірлер: 110
@ddowy
@ddowy Жыл бұрын
Just wanted to say, I have had to gone through this process over a dozen times and I always come back to this video and the nginx set up. Your awesome. Thank you!
@igetpaidtocode
@igetpaidtocode 2 жыл бұрын
Boss! I love these tutorials that you go through simple important steps of AWS and creating your custom environments. Also it makes a lot of sense to have these videos individually instead of searching for something on a 1hour video so thank you very much for this Sam! :)
@SamMeechWard
@SamMeechWard 2 жыл бұрын
🤗🤗🤗
@RolandAyala
@RolandAyala Жыл бұрын
Hi Sam, great stuff. I've decided to ween myself off of beanstalk and find your videos to be concise, informative, and easy to follow. Thank you!!
@JBeique
@JBeique Жыл бұрын
There are tutorial videos, and then there's this tutorial video, which is a tutorial video about deploying Node on an AWS EC2 instance. Great work!
@talatkuyuk6556
@talatkuyuk6556 2 жыл бұрын
Hey, welcome to come back again, after 5 months. Nice to see this video, since I have developed a Nodejs app (TDD with using jest and superset inspiring your tutorials), I was thinking how to deploy and where, and see this video. Very happy.
@shahzadasalman8461
@shahzadasalman8461 2 жыл бұрын
thank you so much, loved your tutorial and you definitely deserve more views and subscribers for your effort
@ayush612
@ayush612 2 жыл бұрын
Thank you sir for this awesome tutorial. Exactly what I needed!!
@bigboot762
@bigboot762 2 жыл бұрын
Thanks man. My task was a little different, but when I gave up and tried everything from scratch, it worked somehow.
@asaflevy9387
@asaflevy9387 2 жыл бұрын
Clear and concise. Thank you!
@kaliteliyazlmc1376
@kaliteliyazlmc1376 Жыл бұрын
Thanks bro! I solved a problem about ec2 I was facing thanks to your video (I forgot to add TCP port rule to security groups) Keep making such good content!!!
@clinto_abraham
@clinto_abraham 10 ай бұрын
This makes sense now. Was always trying to create EC2 but stuck at terminal termination, app used to stop always. Thanks man!
@deepfuchsia7204
@deepfuchsia7204 2 жыл бұрын
Many thanks for sharing your knowledge. It was explained in a very chill and understandable manner. Good shit bro.
@therustguy10
@therustguy10 11 ай бұрын
Hey, sam. Thanks for this amazing video, and also the article!
@gtnasser
@gtnasser Жыл бұрын
Great job. Nice tutorial, easy for undertanding.
@souravdutta5703
@souravdutta5703 2 жыл бұрын
Didn't know Edge left WWE and became a software developer 😉😉Nice explanation btw
@TheObelisc10
@TheObelisc10 2 жыл бұрын
Sir. I love you. Thank you for this amazing video. Helped me get my project of the ground.
@sweatersface1930
@sweatersface1930 Жыл бұрын
thank you, this has been so incredibly helpful
@dinyairsadot9910
@dinyairsadot9910 2 жыл бұрын
You're a life saver man! Great video
@mihiragrawal817
@mihiragrawal817 Жыл бұрын
Thanks dude it was amazingly simple and easy
@FreeTime-0000
@FreeTime-0000 2 жыл бұрын
It's a best video and it's really works smooth I read hundred of documents but I didn't understand how to host but, after seeing your video I understand easily and I host a node app think you very very much I love you............... Keep doing it
@SamMeechWard
@SamMeechWard 2 жыл бұрын
You are most welcome
@node_python_lover454
@node_python_lover454 Жыл бұрын
Thank you very much! Your video saved me a lot of time!
@sergiobost4891
@sergiobost4891 Жыл бұрын
learned so much from this video, subscribed
@temitopealuko4848
@temitopealuko4848 Жыл бұрын
thank you so much for this tutorial, this really help me a lot
@longnhat6405
@longnhat6405 Жыл бұрын
super greate video! thanks a lot. keep doing great work
@subhashgn1775
@subhashgn1775 Жыл бұрын
Sooper useful.👌👌 Very great resource video.
@SamMeechWard
@SamMeechWard Жыл бұрын
Glad you liked it🤗
@netsaosa4973
@netsaosa4973 Жыл бұрын
thanks bro, had trouble when i couldn't use dotenv
@rune1327
@rune1327 2 жыл бұрын
This is extremely useful.
@leonomollo7836
@leonomollo7836 Жыл бұрын
my sincere gratitude, fam. 🙏🙏
@isandozi
@isandozi Жыл бұрын
Hey Sam, great tutorial. Thanks for the work. I had a question, I’m trying to set environment variables in a way where they are not on the actual EC2 instance but in a CI CD pipeline on Azure Devops. In order to set those, do I need to alter the actual in any way?
@madcolor
@madcolor Жыл бұрын
Very useful. Thank you.
@user-is5bs8qb4y
@user-is5bs8qb4y Жыл бұрын
awesome tutorial =D
@magoQuijote
@magoQuijote Жыл бұрын
You are the best Sam! Like
@SamMeechWard
@SamMeechWard Жыл бұрын
🤗
@orangekitty5192
@orangekitty5192 2 жыл бұрын
Great videos!
@markbarlescu1853
@markbarlescu1853 Жыл бұрын
thanks so much for this video !
@SamMeechWard
@SamMeechWard Жыл бұрын
You're so welcome 🤗
@jez6241
@jez6241 Жыл бұрын
This tutorial is awesome! Is there a part 3?
@DaveH28
@DaveH28 Жыл бұрын
This is brilliant tutorial - I had my server al working with systemd until I changed from require(http) to using express
@mrandersoncga
@mrandersoncga 2 жыл бұрын
Thanks for sharing!
@74Bagas
@74Bagas Жыл бұрын
wow, just right on !! subscribed.... now let me binge watch, thank you. - i wish i found this channel earlier 😆, anyway never too late, let's go do some devops sht.
@lawais1977
@lawais1977 Жыл бұрын
nice video! it worked perfectly! I have 2 questions though... 1. Why didnt you use CodeDeploy? 2. How would you integrate this method in a pipeline?
@andrewndotela7407
@andrewndotela7407 2 жыл бұрын
Hello @Sam Meech-Ward, We're enjoying so much with everything you're giving to this channel, would you please make a tutorial on how to deploy laravel app on linux aws, it seems to have many confusing configurations
@MrVicmg11
@MrVicmg11 2 жыл бұрын
cool video!
@SportsMoments697
@SportsMoments697 2 жыл бұрын
Also, if you have the error: "Error: listen EADDRNOTAVAIL", Be sure to use the private IPv4 address of your EC2 instance in your node app in order to properly establish connection. And to test things, use the public one as shown in the video Again, great tutorial btw ^__^
@timmyfrank3
@timmyfrank3 Жыл бұрын
Good video thank you
@SamMeechWard
@SamMeechWard Жыл бұрын
Glad you enjoyed it
@alexciotor
@alexciotor Жыл бұрын
"First Try... That doesn't always happen" soooo true.. so funny and painful at the same time :)))
@411sev
@411sev Жыл бұрын
Thanks
@stareditz7960
@stareditz7960 5 ай бұрын
thanks alot
@brunohlnp
@brunohlnp Жыл бұрын
I reproduce the results of your video. I am not able to use the systemd command to turn the web app into a always-up service. In fact, after starting the pulled repository content (which goes fine hosted locally), its status is (code=exited, status=1/FAILURE). Do you have some idea how to debug this issue?
@chzappsdevelopers737
@chzappsdevelopers737 Жыл бұрын
Love you!!!
@SamMeechWard
@SamMeechWard Жыл бұрын
I love me too 🤗
@ponmaniraja9576
@ponmaniraja9576 2 жыл бұрын
Hi Sorry That was my mistake. Here I didn't Stop node server.js in my terminal. It is wokring After stopped the Terminal node server.js. Thanks Really is helping ur videos.
@mohamedyoussef8835
@mohamedyoussef8835 Жыл бұрын
Awesome video ++++++++++++++++++ 🙂
@nazarenofernandez1509
@nazarenofernandez1509 2 жыл бұрын
I love you!
@CutinChai
@CutinChai Жыл бұрын
do I always have to have my terminal open after starting nodej server? like node server.js
@Alidrkk07
@Alidrkk07 2 жыл бұрын
Thanksss !!!!!!!!
@marvellousadesanya8480
@marvellousadesanya8480 3 ай бұрын
Is there a more efficient way of handling env variables?
@shuklavishwam
@shuklavishwam Жыл бұрын
Hello, Thanks for the video. I tried creating some routes using express but I can’t get a way around on ec2 . It fails with a Error called Cannot Get /routeName. Is there any workaround to get this done?
@meteryard
@meteryard 7 күн бұрын
does this work in docker image i have docker image of my project in ec2 wwith jenkins
@thisgoogleaccount5009
@thisgoogleaccount5009 Жыл бұрын
My EC2 instance doesn't seem to have yum installed and I am having trouble installing it. Why do these things have to be such a pain, also in the security group there seems to be 2 options for "anywhere", anwhere ipv4 and anywhere ipv6. Does that mean I have to make 2 security groups for both of those destinations?
@darrenzou2225
@darrenzou2225 4 ай бұрын
If you are using NVM, then /usr/bin/node WILL NOT WORK you have to use "nvm which " then replace /usr/bin/node with the actual path in the service file other than that 10/10 vid subbed
@thegrantkennedy
@thegrantkennedy Жыл бұрын
Great tutorial Sam. I got a question tho. I followed along, created a systemd service using your script, changed the directories to match my own but when I try to run it, it fails with error code 1. My code runs fine if I run npm start. What could be causing this?
@SamMeechWard
@SamMeechWard Жыл бұрын
Make sure you use the absolute path to the executable ExecStart like /home/ec2-user/whatever/script.js Try running the ExecStart code directly in the command line and make sure that works /usr/bin/node /home/ec2-user/whatever/script.js If you have an EnvironmentFile, make sure that's the correct absolute path
@regancloper
@regancloper 2 жыл бұрын
Is there a reason you don’t want to run the node app on the same EC2 instance as the MySQL DB instance from your prior video? Many of the other tutorials I saw run both node app and DB on same instance.
@SamMeechWard
@SamMeechWard 2 жыл бұрын
Having everything on one instance is fine for a small app, but it makes it impossible to horizontally scale your application. Separating out everything like this makes horizontal scaling very easy.
@ikramkhaldoun5486
@ikramkhaldoun5486 2 жыл бұрын
thanx
@halituzan
@halituzan Жыл бұрын
Hi Sam, I can't thank you enough for this tutorial video. There is a point that I cannot overcome, if you can help me, I will be very happy, even if you just show me the way, it is enough. I am creating a cookie token in my code structure and while this cookie token creation process works very well on my local server, ec2 does not work and generates the token, but it does not set the cookie, I could not understand why.
@akashjohirul9409
@akashjohirul9409 Жыл бұрын
How do we update to the new code? LIke if we make any changes in github how will we update it in the server also?
@shakeelali9418
@shakeelali9418 Жыл бұрын
hello brother, I have a question where I can find the .env file in node js ec2 AWS ubuntu instance and how I can update it
@rololop34
@rololop34 Жыл бұрын
Great tutorial. Where can I learn more about linux server administration for web development like you showed us? Did you learn it by doing or is there a tutorial for this kind of stuff because I cannot find a good one.
@SamMeechWard
@SamMeechWard Жыл бұрын
I learned this stuff by reading some books, reading the docs, reading some articles, watching some videos, and trying over and over again until I got it right. You just gotta keep going, keep trying, keep reading and watching and don't give up until you've figured out how to do the thing you're doing.
@nikj00009
@nikj00009 Жыл бұрын
hey sam, Can you make a video tutorial on AWS x-ray integration with node app in ECS and trace all requests via Xray console.
@CutinChai
@CutinChai Жыл бұрын
do I need to have webserver running on ec2?
@vsvvv22
@vsvvv22 Жыл бұрын
Hi.. How can we get sample project replace with our build code
@DuyTran-ss4lu
@DuyTran-ss4lu Жыл бұрын
cool
@user-fw5zf9te2x
@user-fw5zf9te2x 2 жыл бұрын
I used NVM and Am I same the .service script?
@programmer9809
@programmer9809 2 ай бұрын
👍
@allysantoro6378
@allysantoro6378 2 жыл бұрын
how do i tell it to update my server.js file? It's not updating
@stareditz7960
@stareditz7960 5 ай бұрын
add the security bound of http and while accessing the pubilc ip address change it from https -> http
@gangumalladheemanth1048
@gangumalladheemanth1048 Жыл бұрын
I followed the steps to host a website but when i am hosting i'm unable to render the images. Please help me out guys
@vortextraininggroup9243
@vortextraininggroup9243 2 жыл бұрын
Hi, I am currently running into some issues using lightsail and the forever script. The systemD that you spoke of. Would that work within lightsail aswell?
@SamMeechWard
@SamMeechWard 2 жыл бұрын
Yes systemd works on any Linux system
@vortextraininggroup9243
@vortextraininggroup9243 2 жыл бұрын
@@SamMeechWard Perfect thankyou :)
@solomonkorede07
@solomonkorede07 2 ай бұрын
can this also work for Mongo Db
@haseebullah9204
@haseebullah9204 2 жыл бұрын
hi , I just followed your tutorial but I am unable to access the test or any route, even the nodejs app is running "This site can’t be reached" is being displayed. need help regarding this ..
@SamMeechWard
@SamMeechWard 2 жыл бұрын
If you can't connect to the site, it might be an issue with the security group and port number. Make sure your port number is correct and try opening up your security group to allow traffic on all ports to see if that helps.
@aliceg.2629
@aliceg.2629 26 күн бұрын
Note for myself: Need to get back to 1:02 when deploying our node App
@MultiHeywatsup
@MultiHeywatsup 9 ай бұрын
Git validation?
@TheEnigma9000
@TheEnigma9000 Жыл бұрын
I can’t find the node app you’re using on your GitHub. Which is it?
@SamMeechWard
@SamMeechWard Жыл бұрын
github.com/sam-meech-ward-bcit/lotr
@ahmedalobed7382
@ahmedalobed7382 Жыл бұрын
when i run my project this error occur [722:0x4dede40] 13621 ms: Scavenge 468.9 (479.1) -> 468.5 (479.6) MB, 5.4 / 0.0 ms (average mu = 0.358, current mu = 0.415) allocation failure [722:0x4dede40] 14106 ms: Mark-sweep (reduce) 469.4 (479.6) -> 469.1 (479.4) MB, 342.1 / 0.0 ms (+ 61.5 ms in 12 steps since start of marking, biggest step 18.3 ms, walltime since start of marking 422 ms) (average mu = 0.271, current mu = 0.192) alloc FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory 1: 0xb02960 node::Abort() [node] 2: 0xa18149 node::FatalError(char const*, char const*) [node] 3: 0xcdd22e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 4: 0xcdd5a7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 5: 0xe94c15 [node] 6: 0xea48dd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 7: 0xea75de v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node] 8: 0xe68b1a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node] 9: 0x11e1886 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node] 10: 0x15d54f9 [node] Aborted
@michaelpoon3083
@michaelpoon3083 2 жыл бұрын
I saw my service status is active, but I can't load my web page... is there something wrong?
@michaelpoon3083
@michaelpoon3083 2 жыл бұрын
it appears code: 'ERR_INVALID_ARG_TYPE' in the var/log/messages
@FRanger92
@FRanger92 7 ай бұрын
why not just use NVM ?
@nwigweuzochukwu6089
@nwigweuzochukwu6089 2 жыл бұрын
My keypair isn't accessible
@SamMeechWard
@SamMeechWard 2 жыл бұрын
Did you chmod 400 your key?
@vicnguyen9312
@vicnguyen9312 Жыл бұрын
Did you forget to install npm on linux machine?
@SamMeechWard
@SamMeechWard Жыл бұрын
it installed itself
@Antiilitratepeople
@Antiilitratepeople Жыл бұрын
variable in clear instead of in the secret manager!!! Not so safe.
@SamMeechWard
@SamMeechWard Жыл бұрын
Safe enough and ferric enough to work on any Linux and cloud environment. But secret manager makes encryption and managing secrets and rotations and other things easier, but it costs money and you have to learn how to use that service correctly
@warpspeed8305
@warpspeed8305 Жыл бұрын
Why 8080 and not 80?
@SamMeechWard
@SamMeechWard Жыл бұрын
because only privileged applications can access privileged ports like 80 and your web app should NOT be privileged
@arvinlorenz
@arvinlorenz Жыл бұрын
HI Sam.. Thank you for the tutorial. I just have a question. When I use Https to create connection, the systemd service is not working anymore. https .createServer( { key: privateKey, cert: certificate, }, app ) .listen(process.env.PORT || 8443) Will I change something from the systemd service?
@MoR555777
@MoR555777 Жыл бұрын
Hey Sam! Your videos are super helpful, thx! I have one question please 🙏🏻 when I tryed to set up the db to the server machine Using the environment variables I got this error “MYSQL_HOST: command not found”. * I have the .env file (and insert it to the gitignore like I should) with the environment variables like yours. * looked for the error but couldn’t find anything helpful. Do you know what the problem can be?
@SamMeechWard
@SamMeechWard Жыл бұрын
Did you add the environment variables file path to the systemd file?
@MoR555777
@MoR555777 Жыл бұрын
@@SamMeechWard Yes. The problem was a spare whitespace at the terminal 😅 Thank you! Your videos are super helpful!
Nginx Reverse Proxy on AWS EC2 Amazon Linux 2
10:26
Sam Meech-Ward
Рет қаралды 38 М.
ТАМАЕВ vs ВЕНГАЛБИ. Самая Быстрая BMW M5 vs CLS 63
1:15:39
Асхаб Тамаев
Рет қаралды 3,8 МЛН
В ДЕТСТВЕ СТРОИШЬ ДОМ ПОД СТОЛОМ
00:17
SIDELNIKOVVV
Рет қаралды 3,9 МЛН
Китайка и Пчелка 4 серия😂😆
00:19
KITAYKA
Рет қаралды 3,6 МЛН
AWS VPC & Subnets For Beginners
16:39
Sam Meech-Ward
Рет қаралды 53 М.
Auto Scaling and Load Balancing on AWS
22:53
Digital Cloud Training
Рет қаралды 2,2 М.
How to deploy a Node Express API to AWS EC2 instance
18:17
JonathanSanchez
Рет қаралды 52 М.
Upload Images to S3 from Node Back End
26:02
Sam Meech-Ward
Рет қаралды 145 М.
Intro to RDS in AWS for MySQL
19:31
Sam Meech-Ward
Рет қаралды 12 М.
MySQL on AWS EC2 Amazon Linux 2
12:44
Sam Meech-Ward
Рет қаралды 23 М.
Top 8 Docker Best Practices for using Docker in Production
18:27
TechWorld with Nana
Рет қаралды 297 М.
Deploy NodeJS Application on AWS - Amazon Web Services | NodeJS
19:51
China 🇨🇳 Phone 📱 Charger
0:42
Edit Zone 1.8M views
Рет қаралды 382 М.
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 6 МЛН
Непробиваемый телевизор 🤯
0:23
FATA MORGANA
Рет қаралды 407 М.
📦Он вам не медведь! Обзор FlyingBear S1
18:26