Node.js Deploy to Amazon Web Services (AWS) Tutorial (Elastic Beanstalk, Express, Git, CI/CD)

Поделиться
HTML-код
  • Опубликовано: 14 янв 2025

Комментарии • 185

  • @robertgioeli3211
    @robertgioeli3211 2 года назад +13

    Caleb I know it's 2 years later but thanks for this video bro. You've always had down to earth explanations that people from all learning styles can understand.

  • @ThatsPety
    @ThatsPety 4 года назад +84

    If you're watching this, here's whats going on with the 502 error:
    Don't make a new variable in elastic beanstalk called "port"! Amazon already sets the environment variable for you...but they set the variable "PORT", not "port". So in your app.js code change "process.env.port" to "process.env.PORT" and things will work properly...
    Except they won't. For a lot of you, you're still getting a 502 error. But that isn't because of the port; your application simply can't start, with or without AWS. The issue is that AWS is trying to run a command like "npm start" but it isnt working. On your local machine navigate to the project directory in your terminal and try "npm start". If that fails, then you've found the problem. Here's how you fix it...
    npm start, by default, looks for a file called "server.js", not "app.js" like he told you to name your file. There are two solutions. The first is to change the settings in your project to make it look for "app.js" instead. The second solution is to simply change "app.js" file name to "server.js". I recommend the second option.
    Repush after making these changes and you should be good to go.

    • @valiant7057
      @valiant7057 4 года назад

      This 100% solved my issue with bad gateway. Thanks!

    • @andrewradulescu
      @andrewradulescu 4 года назад +1

      +1

    • @garinnmorton9640
      @garinnmorton9640 4 года назад

      @Pety im still getting the 502 error :( any other suggestions? Im getting both connections just fine, it just won't let me open up the web app

    • @garinnmorton9640
      @garinnmorton9640 4 года назад

      im also trying to return in an html page, not just a welcome message

    • @ThatsPety
      @ThatsPety 4 года назад

      @@garinnmorton9640 oh no! when you run "npm start" on your local machine, does it work?

  • @sebastianraab4887
    @sebastianraab4887 4 года назад +4

    You, Sir, are a true hero. Not the hero we deserved, but the hero we needed.

  • @richie-bonilla
    @richie-bonilla 4 года назад +38

    >"502 Bad Gateway, yeah!... so that's the end of the tutorial."
    hahahaha

  • @AydinCodes
    @AydinCodes 2 года назад

    Almost 3 years later, and this is the best tutorial i've ever seen. Thank you so much

  • @cliffvbajo
    @cliffvbajo 3 года назад +1

    I like that you showed even the errors you encountered so that it can help us debug/fix it. Thank you buddy! I will slap the "like" button and subscribe too!

  • @omerlev7776
    @omerlev7776 4 года назад +7

    FINALLYYYYY, a good tutorial on how to deploy with aws. THANK YOU!!!!

  • @josephwong2832
    @josephwong2832 4 года назад +3

    Thanks a lot Caleb!
    Love how you celebrate your failures/errors. That's the best attitude

  • @nishantsethi6625
    @nishantsethi6625 2 года назад

    I am halfway to the video, the way you summed up everything. its marvellous and big thank you

  • @SrRunsis
    @SrRunsis 4 года назад

    Man just what I needed! Thanks!
    If any of you guys is having trouble trying to connect to a RDS Database from an Elastic Beanstalk Node.JS app check the SECURITY GROUP POLICY of the DB to accept traffic from Custom > Your Beanstalk Instance (this must be done manually) . Also check if you have a NPM RUN script in your package.json (it wont work otherwise) and your ENVIRONMENT VARIABLES set in the Beanstalk environment section.

  • @jonjon4796
    @jonjon4796 4 года назад +21

    Yes caleb we are very interested on a tutorial on how to use mongo db with this. pls do

  • @jameschhun6200
    @jameschhun6200 3 года назад +1

    Hey man thanks for this video, I used to watch you alot during my senior year of university for DBMS. Glad to see that 3 years later you're still producing content that is completely relevant to me haha

  • @alexandermichaud957
    @alexandermichaud957 2 года назад +1

    This was exactly what I needed to get my app up and running. Thank you for a down-to-earth, straightforward tutorial

  • @Chrrxs
    @Chrrxs 4 года назад +39

    For anyone watching and still getting a 502 error make sure to define a "start" script in your package.json, in my case I did:
    "start":"node app.js"
    Also make sure to define your port in env config and look in the logs to see which port your environment is running on

    • @Heliotropeeee
      @Heliotropeeee 3 года назад

      god bless you man, the problem was the json file.
      people, be careful even if the "start":"nodemon server.js" looks like this.
      it will BE WRONG because of nodemon, just use node server.js as well or app.js if thats the case

    • @reesharper7506
      @reesharper7506 3 года назад +1

      @@Heliotropeeee I wish I read the comments earlier, I just found it in the logs that nodemon was the issue. then I came to the comments and immediately saw this hahaha

  • @nicholasdaniel-richards1309
    @nicholasdaniel-richards1309 2 года назад

    Bloomin eck Caleb - nicely done. I needed a very simple start for my first was deploy - I feel like I learned all the steps waaay beyond this and was missing this critical step. Subscribed. Thank you.

  • @jaydave791
    @jaydave791 4 года назад +8

    instead of adding port as env variable you should use PORT(all caps) in your code for it to work also it is a good practice to have environment variables in all caps

  • @sohailb1894
    @sohailb1894 2 года назад

    The best tutorial on deployment of node project on AWS! thanks

  • @suhaib404
    @suhaib404 4 года назад +1

    This video is gold.

  • @runningfox4049
    @runningfox4049 2 года назад

    worked first time. great tutorial. keep up the great work. thank you

  • @adrianfittolani5001
    @adrianfittolani5001 4 года назад +4

    So good. Thank you. This worked great for me (had been trying to figure it out for a while). Site up and going , until it's time to hit the DB on Atlas! Would be great to see the Mongo DB part you were going to do.

  • @ThomasFaller
    @ThomasFaller 4 года назад +1

    Love the video and your attitude! Keep it up!
    When you see the kind of videos AWS Solution Architects make you're happy that they're not the only ones.

  • @QuakerRaze
    @QuakerRaze 4 года назад +7

    You're the best, God bless.

  • @GabeSegura94
    @GabeSegura94 4 года назад +2

    That deployment reaction is one we all know all too well! 😂😂

  • @azamsharp
    @azamsharp 3 года назад +1

    Thank you!

  • @noobminer3136
    @noobminer3136 4 года назад +1

    I had a local env with mongoDB/atlas but it was impossible to find a tutorial on how to bring everything live. Your tutorial nailed it thanks!

  • @lucasmazaron718
    @lucasmazaron718 2 года назад

    Thank you from Brazil! You helped me a lot hehe

  • @joeyjohnson4153
    @joeyjohnson4153 4 года назад

    haven't finished watching this but already loving it. Subscribed straight away. I am in the process of making a complete career re-direction aka "CHANGE" and will need easy-to-follow videos like this one here. Nice one Caleb!!

  • @gavinhatch9991
    @gavinhatch9991 3 года назад

    9:49 "Maybe it's not. I don't know. I don't know your life!" bro i died.

  • @aryankathawale9269
    @aryankathawale9269 2 года назад

    thank you , you just made my job 5X easier

  • @nicolasportu
    @nicolasportu 2 года назад

    Outstanding! Cristal clear :)

  • @MrCoolieification
    @MrCoolieification 4 года назад +1

    Very informative video, I appreciate you showing us the trial and error and breaking down concepts. Thank you.

  • @vivekmankar5823
    @vivekmankar5823 4 года назад

    I subscribed to the channel as soon as I finished the video! Awesome work Bro !

  • @tanaiudomtanapaiboon7207
    @tanaiudomtanapaiboon7207 2 года назад

    solve the problem Caleb, thank you very much.

  • @Justin-te2kg
    @Justin-te2kg 2 года назад

    20:04 an emotion felt by programmers universally

  • @eniolotero8808
    @eniolotero8808 3 года назад

    Thanks a lot for this man. I really needed it

  • @nikmanzo8569
    @nikmanzo8569 4 года назад +2

    Yeah! A CRUD app would be great! THanks!

  • @juliuspetre4704
    @juliuspetre4704 3 года назад

    Your awesome dude! I already hit the subscribe button! Please do more Videos just like this one.

  • @sondaika12
    @sondaika12 4 года назад

    Thanks Caleb, you're awesome as always. Cheers

  • @redvalley99
    @redvalley99 4 года назад

    youre a life saver sir

  • @HuyLe-pm9tk
    @HuyLe-pm9tk 3 года назад

    You saved my day. Thank you so much !!

  • @mathiusjordan97
    @mathiusjordan97 3 года назад

    Amazing video! I was so confused with all the different pieces just reading the docs 🥵

  • @salmankazi5308
    @salmankazi5308 4 года назад

    Thank So So So So Sooooo Much Brother... Was Watching and Doing The work at 3:43AM ..And Yes It Worked Perfectly..!!! LIKED + SUBSCRIBED!!1

  • @bryanoliverosperez8827
    @bryanoliverosperez8827 3 года назад

    thank you so much, I learned something new

  • @tolu-john
    @tolu-john 2 года назад

    This video was exactly what I was looking for. Your the best

  • @eddiehernandez70
    @eddiehernandez70 4 года назад +1

    Great tutorial. Exactly what I needed. Thanks!

  • @bitsiot
    @bitsiot 3 года назад

    Great demo, provides value.

  • @canadasistersforchrist8656
    @canadasistersforchrist8656 4 года назад

    Really helped so much. Please keep doing this great work.

  • @ziat1988
    @ziat1988 2 года назад

    Hey Caleb, How we can add the mongo db to that workflow?

  • @md.mehrabhaque2223
    @md.mehrabhaque2223 4 года назад

    Brooooooo , it's a gemmmm !!!!!!!!!!!!!!! not only subbed, smashed that bell also !!!!!!!!!!!!!!!!!!!!!!!!!

  • @jgvidotto
    @jgvidotto 4 года назад +3

    tutorial start at 10:36

  • @abdur-rakib
    @abdur-rakib 3 года назад

    Wow! great video👍

  • @tolu-john
    @tolu-john 2 года назад

    Awesome video. How do I set up staging and development environment using ELB from different branches

  • @visvm747
    @visvm747 4 года назад

    Cool Caleb. Tip for beginners, AWS EB considers app.js as default start script. If different, explicitly mention in package.json. "start": "src/app-main.js"

  • @louleg23
    @louleg23 3 года назад

    Great tutorial thanks! Just what I was looking for. Would love one that includes mongo too.

  • @miguelbas
    @miguelbas 3 года назад

    This tutorial is amazing, thank you

  • @rk_nyra
    @rk_nyra 4 года назад

    Very helpful! Thanks for sharing!!

  • @circulgaming
    @circulgaming 4 года назад +2

    Nice video! I'll be waiting for the next vid about how to include mongo on this setup, thanks!

  • @rahulshimpi8914
    @rahulshimpi8914 4 года назад

    Thank You So.............................Much Sir. Finally, deploy my node application on AWS and it's working fine. One more time thanks and also subscribe to your channel.

  • @AbhilashKhuntia
    @AbhilashKhuntia 10 месяцев назад

    I have created a express app with around 10 api endpoints and hosted on elastic beanstalk server, how do I check how much compute resource each endpoint is taking?

  • @slal
    @slal 3 года назад

    Really good information !!

  • @titaniumwolf2
    @titaniumwolf2 4 года назад

    Thank you caleb.

  • @spencerjin8370
    @spencerjin8370 4 года назад

    Cool tutorial! Thanks man!

  • @НуркасымАязбекулы
    @НуркасымАязбекулы 2 года назад

    Hi Caleb!
    Could you please help me with deployment my NodeJS application?
    I did everything according to your tutorial, but for some reason only the deploy to the AWS EB does not work

  • @4dagi01
    @4dagi01 4 года назад

    Gracias master, saludos Guarne-Colombia

  • @MuhammadKashif-bq4ht
    @MuhammadKashif-bq4ht 3 года назад

    thank God you finally did, I thought you would say "We couldn't make it in this tutorial, let me create another one and watch it next week" hah, anyways, Great stuff very helpful!

  • @shankarasam8205
    @shankarasam8205 4 года назад

    understood 100%, thanks...

  • @websidevteam3046
    @websidevteam3046 4 года назад

    You are a life saver thanks a ton!

  • @faisalkhan-gy5ef
    @faisalkhan-gy5ef 4 года назад

    Crystal clear

  • @November17th
    @November17th 3 года назад

    Happy teacher's day bro 😌😌

  • @PierreAndNick
    @PierreAndNick 4 года назад +4

    Hey man, I keep getting this error when I try deploy the pipeline, do you know what the issue could be?
    Action execution failed
    Deployment completed, but with errors: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version. Failed to deploy application. Unsuccessful command execution on instance id(s) 'i-08cb1ec6aa6770914'. Aborting the operation. [Instance: i-08cb1ec6aa6770914] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].

    • @xiaoyuelyu8539
      @xiaoyuelyu8539 4 года назад +1

      get the same issue. did you find way to solve it?

    • @caloski
      @caloski 4 года назад +1

      @@xiaoyuelyu8539 any news?

    • @manuh8860
      @manuh8860 4 года назад

      Can anyone help here. I am getting same error

    • @mustkeemk5506
      @mustkeemk5506 4 года назад

      For someone who is getting this error - the solution is you might have defined node version in your package.json file. Correct it or remove details of node version from your package.json file. Cheers...

  • @sambarvada
    @sambarvada 4 года назад

    Do we need to use docker or jenkins with elastic beanstalk?

  • @bryceblankinship
    @bryceblankinship 3 года назад

    All the checks passed, my code is the same, but the public url times out every time. Do you have any possible solutions?

  • @unknowntomeknowntoyou
    @unknowntomeknowntoyou 2 года назад

    I know this is later but im having this problem still with the 502 nginx error and the port fix doesnt work but im also using a Postgres db thats on RDS and i think that may be causing the issue as well. any suggestions?

  • @WanhedaPY
    @WanhedaPY 4 года назад

    Nice video, pretty helpful, thanks for simplifying

  • @ramirodiazortiz
    @ramirodiazortiz 4 года назад

    Awesome! Thanks for sharing! :)

  • @kavindumadushanka9802
    @kavindumadushanka9802 4 года назад

    Thank you so much! btw some differences were there when running this in my case. By the help of the comment section I was able to deploy my app. Great Explanation 🤩❤️

  • @PrinjuVaidyan
    @PrinjuVaidyan 4 года назад

    i cant see the container options ,,please help?
    nodejs deployment

  • @KM-zd6dq
    @KM-zd6dq Год назад

    Preying is a very important part of the process 20:03

  • @anillip1
    @anillip1 4 года назад +3

    100% helpful mate, Could you please revert the mongodb with aws video ulr please ?

  • @jacoblucas6035
    @jacoblucas6035 Год назад

    Thank you!

  • @a_b_p97
    @a_b_p97 4 года назад

    will beanstalk know which command to use to run the node server

  • @mariorodriguez8613
    @mariorodriguez8613 Год назад

    you are awesome bro

  • @AshCarnov
    @AshCarnov 2 года назад

    Thanks a lot!

  • @kumarvishalben
    @kumarvishalben 3 года назад

    Beanstalk URL doesn't have HTTPS enabled 😭.
    Is there a way to add SSL in the load balancer without custom domain ???

  • @sanketss84
    @sanketss84 4 года назад

    Thanks this has been helpful :)

  • @apurvaraghu1597
    @apurvaraghu1597 4 года назад

    we dont need a ec2 instance here?

  • @deian85
    @deian85 3 года назад

    I’d be interested in the mongodb part

  • @frankellyguzman4297
    @frankellyguzman4297 3 года назад

    Love this videos

  • @CodingJourney
    @CodingJourney 4 года назад

    Amazing guide!! 🙏💙

  • @vineethavvaru6058
    @vineethavvaru6058 4 года назад

    Thank you very much man !!

  • @HeronHideki
    @HeronHideki 3 года назад

    Thanks Thanks Thanks Thanks..
    You got a New subscrever

  • @hancock373
    @hancock373 4 года назад

    help me a lot, thank you bro

  • @alexlindgren1
    @alexlindgren1 4 года назад

    Really cool man thanks for the tutorial, just what I needed. I had to open port "8080" in my settings, so guess they are distributed differently, maybe you should put that into the description if someone has the same issue (you find it in the log if anyone missed that).

  • @venil82
    @venil82 4 года назад

    thanks! this was useful

  • @hjab
    @hjab 4 года назад +1

    it's very useful but still get the error 502! no google answer :( .. What was ur problem share plz.

  • @demonknightd
    @demonknightd 3 года назад

    “we want to deploy node.js REST API on AWS. currently using elastic beanstalk service to deploy the api from github. But we want to enable "https" on our api. right now the url that aws gives is http only”

  • @kumarandtechie9558
    @kumarandtechie9558 3 года назад

    Good, Keep it up....

  • @Naniy55462
    @Naniy55462 2 года назад

    it works but its not free, internally load balance is used with t2.small instance type which is not free and there is no way of stopping application, only termination of application is available. pls suggest some free instance

  • @taofeekolalekan3399
    @taofeekolalekan3399 4 года назад +1

    For any gateway issues.
    const port = process.env.PORT || 3000 use PORT instead of port

  • @bobaashenvale3968
    @bobaashenvale3968 4 года назад

    You can type in order to open your current directory in VS Code directly.