Deploy a Node.js application on AWS Elastic Beanstalk

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign hey guys in this lesson we're going to deploy an AWS elastic Beanstalk application and keep it interesting we'll do a few things we'll upload a different version of the code and we're also going to create a second web server environment and see how we can play around with swapping URLs okay so I'm in the elastic Bean sort console now at the point in time that I'm recording this there is a new console it's brand new looks a little bit different and unfortunately it doesn't work very well so I have tried it out and this lab doesn't work correctly at this point in time so we're gonna have to use the current one so let's create a new Beanstalk application let's give it an application name I'll just call it my Beanstalk app we don't need to give it any tags now we do need to choose a platform so what is the platform we're going to use I'm going to use node.js of course it's quite a few different options there for various different programming languages now I'll leave the defaults and it will upload some code automatically or utilize some code which is sample application code from aw s so we don't need to change anything here now we could just create our application or we can have a quick look at configuring more options so let's have a look at the extra options so we know what's here the first thing is we have some presets so we can choose whether we want a single instance or whether we want to go through to things like high availability we can change the platform here we can do things like enable x-ray for tracing weak and change the configuration of our instances and update our capacity with the types of instance types we want to use for example you can add a load balancer you can configure the policies for Rolling updates configure security monitoring managed updates and so on you can even add in your database configuration here now I'm happy with what I've got so I'm just going to create my application so what happens is we create an application and then within that it creates an environment so we can see we now have the application my Beanstalk app and then the environment my Beanstalk app EnV and on this page if I just click on this option here we can then see a bit of information Nation about what's going on we can see the console here showing us the actual configuration being created now in the background there's some work going on on cloud formation so if we head over to cloudformation we can actually have a quick look at what's going on and we actually have a stack create in progress so when you create a beanstalk environment a stack is being created for you you can come in here and you can see the various elements of that stack so that should take a few minutes and once it's finished we'll have a URL that we can use to connect to the sample application web page okay so that has completed we now have our Beanstalk application available if we go to cloud formation we can see that everything is complete you can have a quick look at the resources that have been created and you can see an auto scaling group for example launch template and elastic IP and so on so coming back to be installed we now have this URL we can click on this URL and it takes us to the application which is just a simple landing page for node.js so let's go back to the the dashboard of course we've got on the left hand side here the environment and then the application above it and we can see for the environment we can still go in and configure the various settings so we can update the configuration lots of different options here you can go and have a look at logs if you've updated logs and you can have a look at the health of the environment for example now what we're going to do is let's go up to application versions you can see that we've got the sample application so we only have one version at the moment of our application in the course download you'll find a folder called AWS elastic Beanstalk and in there you'll find the ZIP file now this is the same node.js code that AWS use when we use the sample application so what I'm going to do I'm just going to unzip that file I'm going to come in and I'm going to go to the index.html and open it in Visual Studio code so this is the file now what I want to do is I just want to change the background color so we can see it it's on line 38 here I'm literally just going to backspace all of these numbers and just type in the word let's put blue take that one away let's just say yeah it fills it in for you so that's fine it comes up with a color that tells me that it's actually worked and then I'm just going to save that file now I want to come back and whilst I'm in this directory so make sure you don't go and zip up this directory go in the directory highlight everything and then compress it or zip it depending on your operating system so now we've got our node js Dash blue just call it node.js blue and what we're going to do is upload this to elastic Beanstalk and then deploy an updated version of our application so back in application versions let's click on upload and this one I'm going to call node Dash blue I'm going to choose a file I'm going to find that file which is in AWS elastic Beanstalk here it is the zip file node.js blue dot zip so that's all I need to do I can upload my file so now I have some new source code now it hasn't changed anything on my application all we've done is we've simply uploaded the code so we now have another version that we can potentially deploy to our environment so what I'll do is I'm actually going to choose node blue I'm going to go to actions and then deploy and then now I'm going to choose my environment I've only got one option so I'm going to deploy it straight to my environment what we should see if we go back to environments is an update is actually taking place okay my update has completed successfully didn't take too long so now if I go back to this page here give it a refresh and now my application is blue all right so that's simply uploading a new version and then deploying that new version straight onto our application now of course we only had one instance in this case by the way you can go to ec2 and have a look there you will see your instance running in ec2 what we might want to do is actually configure our updates on a separate instance and then we can use the swap URLs functionality so what we've done is we've just deployed a new version of our application straight on to the ec2 instance now by the way you can see that instance in ec2 if you go and have a look there now we might not want to deploy an update directly to our live system we might want to deploy it somewhere else first check it and then use the URLs functionality to swap URLs between environments so that's what we're going to do now what we need to do is go to our application let's click on our application and within the application we're going to create a new environment it's going to be a web server environment so we can see the environment name is being populated for us I'm just going to call this N2 just so I can be absolutely sure of which one this is then what we're going to do is just choose the node.js option again with a sample application now we know that's the green application we've already changed our live environment to Blue so that's all I need to do let's just create this environment and again that will take a few minutes to create the environment for us so my new environment my second environment environment 2 is now available if I click on the link I now get the green landing page so I've got the blue one and the green one now what I want to do now because I've deployed a second version of my application maybe I've run my updates there and I want to swap the URLs so in other words I want to redirect the live traffic from one instance to the other one across one environment to the other environment the way we can do that is we go to actions and swap environment URLs and so here I just select the environment that I want to swap click on Swap and that's going to make that change for us and you can see that's really quick it says it's completed swapping the C names for the environments so now if I click on environment 2 using the URL here I get the blue application and if I come back and I go to my other environment let's go to the original environment just down here click on this one remember this one was blue now it's green so that's how the swapping of URLs works so that's it for this lesson I've finished with this particular demonstration so I'm willing to terminate my environments one by one so let's just select the name of the environment pop that in the confirmation box and of course this will initiate the termination the deletion of the resources via cloud formation I'll do the same with my second environment here and that will clean everything up foreign [Music]
Info
Channel: Digital Cloud Training
Views: 16,538
Rating: undefined out of 5
Keywords: AWS, AWS Certification, Amazon Web Services, AWS Amazon, AWS Certified, AWS Training, AWS tutorial, Amazon AWS, What is AWS, Getting started with AWS, Amazon AWS tutorials, AWS Fundamentals, free aws, free aws tutorials, AWS Cloud, AWS Exam, AWS Practice Tests, Cloud Computing, Cloud Technology, Cloud career, AWS Jobs, AWS career, AWS for beginners, Introduction to AWS, AWS Services, AWS Elastic Beanstalk, Node.js applicaton, SysOps Administrator
Id: dWfng4qJYMU
Channel Id: undefined
Length: 8min 33sec (513 seconds)
Published: Tue May 16 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.