{"id":3059,"date":"2022-09-21T12:12:51","date_gmt":"2022-09-21T12:12:51","guid":{"rendered":"https:\/\/www.checkmateq.com\/blog\/?p=3059"},"modified":"2023-08-04T14:16:42","modified_gmt":"2023-08-04T14:16:42","slug":"node-js-application","status":"publish","type":"post","link":"https:\/\/www.checkmateq.com\/blog\/node-js-application","title":{"rendered":"How to deploy Node.js application with Elastic Beanstalk"},"content":{"rendered":"<p><strong>AWS Elastic Beanstalk<\/strong> is a cloud service provided by <a href=\"https:\/\/www.checkmateq.com\/aws-cloud\">AWS<\/a> using which you can <strong>quickly build and maintain apps in the AWS Cloud<\/strong> without needing to understand the infrastructure required to run those applications. It <strong>lessens the complexity of management<\/strong> without limiting choice or control. You only need to upload the application code and, <strong>Elastic Beanstalk will take care of the<\/strong> <strong>capacity provisioning, load balancing, scaling, and application health monitoring information automatically<\/strong>.<\/p>\n<p>Applications created in <strong>Go<\/strong>, <strong>Java<\/strong>,<strong>.NET<\/strong>, <strong>Node.js<\/strong>, <strong>PHP<\/strong>, <strong>Python<\/strong>, and<strong> Ruby<\/strong> are supported by Elastic Beanstalk. Elastic Beanstalk creates the chosen supported platform version and sets up one or more AWS resources, like Amazon EC2 instances, to run your application when you deploy it.<\/p>\n<p>In this blog, we will deploy a Node.js application using Elastic Beanstalk through the command line.<\/p>\n<h3>Prerequisites:<\/h3>\n<ul>\n<li>A host machine with aws cli installed.<\/li>\n<li>The host is configured with IAM user profile with AWS Elastic Beanstalk administrator access policy attached to it.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3066\" src=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-custom-java-development-300x46.png\" alt=\"\" width=\"750\" height=\"115\" srcset=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-custom-java-development-300x46.png 300w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-custom-java-development-1024x157.png 1024w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-custom-java-development-768x118.png 768w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-custom-java-development-1200x184.png 1200w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-custom-java-development.png 1417w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<h3>Step1: Install EB CLI<\/h3>\n<ul>\n<li>Run the following command to install the ebcli.<\/li>\n<\/ul>\n<pre>pip install awsebcli --upgrade --user\r\n<\/pre>\n<ul>\n<li>Open the shell profile script in the user directory and add the path to the executable file to your path variable.<\/li>\n<\/ul>\n<pre>sudo vi ~\/.bash_profile\r\n<\/pre>\n<pre>export PATH=~\/.local\/bin:$PATH\r\n<\/pre>\n<ul>\n<li>Verify if ebcli is installed with the following command.<\/li>\n<\/ul>\n<pre>eb --version\r\n<\/pre>\n<h3>Step2: Create Beanstalk environment<\/h3>\n<ul>\n<li>First, go to your project directory and initialize git.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3081\" src=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-game-development-company-1-300x100.png\" alt=\"Elastic Beanstalk\" width=\"744\" height=\"248\" srcset=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-game-development-company-1-300x100.png 300w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-game-development-company-1-768x257.png 768w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-game-development-company-1.png 802w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Use the following command to initialize git.<\/li>\n<\/ul>\n<pre>git init\r\n<\/pre>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3075\" src=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-it-support-services-1-300x125.png\" alt=\"Elastic Beanstalk\" width=\"754\" height=\"314\" srcset=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-it-support-services-1-300x125.png 300w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-it-support-services-1-1024x427.png 1024w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-it-support-services-1-768x320.png 768w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-it-support-services-1.png 1068w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<ul>\n<li>Create a .gitignore file and add the following in it.<\/li>\n<\/ul>\n<pre class=\"highlight javascript\"><code><span class=\"nx\">node_modules<\/span><span class=\"o\">\/<\/span>\r\n<span class=\"p\">.<\/span><span class=\"nx\">gitignore<\/span>\r\n<span class=\"p\">.<\/span><span class=\"nx\">elasticbeanstalk<\/span><span class=\"o\">\/<\/span><\/code><\/pre>\n<ul>\n<li>Next, create a repository with the following command.<\/li>\n<\/ul>\n<pre>eb init --platform node.js --region us-east-2\r\n<\/pre>\n<ul>\n<li>Create a file &#8216;Procfile&#8217; and copy the following in it.<\/li>\n<\/ul>\n<pre>vi Procfile\r\n<\/pre>\n<pre>web: npm start\r\n<\/pre>\n<ul>\n<li>Commit the files using git.<\/li>\n<\/ul>\n<pre>git add .\r\n\r\ngit commit -m \"first deploy\"\r\n<\/pre>\n<ul>\n<li>Create the environment using the following command.<\/li>\n<\/ul>\n<pre>eb create\r\n<\/pre>\n<ul>\n<li>Enter environment name and DNS prefix and select type of load balancer.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3083\" src=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-graphic-design-services-1-300x114.png\" alt=\"Elastic Beanstalk\" width=\"761\" height=\"289\" srcset=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-graphic-design-services-1-300x114.png 300w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-graphic-design-services-1-768x291.png 768w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-graphic-design-services-1.png 1015w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3084\" src=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-software-development-1-300x70.png\" alt=\"Elastic Beanstalk\" width=\"750\" height=\"175\" srcset=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-software-development-1-300x70.png 300w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-software-development-1-1024x238.png 1024w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-software-development-1-768x179.png 768w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-software-development-1-1536x358.png 1536w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-software-development-1-1200x279.png 1200w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-software-development-1.png 1731w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3085\" src=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-application-development-services-1-300x23.png\" alt=\"\" width=\"1141\" height=\"88\" srcset=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-application-development-services-1-300x23.png 300w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-application-development-services-1-1024x78.png 1024w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-application-development-services-1-768x58.png 768w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-application-development-services-1-1536x117.png 1536w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-application-development-services-1-1200x91.png 1200w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-application-development-services-1.png 1698w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<ul>\n<li>To check the status of the environment use the following command.<\/li>\n<\/ul>\n<pre>eb status\r\n<\/pre>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3088\" src=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/hire-software-development-Team-1-300x67.png\" alt=\"Elastic Beanstalk\" width=\"748\" height=\"167\" srcset=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/hire-software-development-Team-1-300x67.png 300w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/hire-software-development-Team-1-1024x230.png 1024w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/hire-software-development-Team-1-768x172.png 768w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/hire-software-development-Team-1-1536x344.png 1536w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/hire-software-development-Team-1-1200x269.png 1200w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/hire-software-development-Team-1.png 1570w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<ul>\n<li>Copy the CNAME and use your browser to access the application.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-3089\" src=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-it-service-2-300x300.png\" alt=\"Elastic Beanstalk\" width=\"734\" height=\"734\" srcset=\"https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-it-service-2-300x300.png 300w, https:\/\/www.checkmateq.com\/blog\/wp-content\/uploads\/2022\/09\/Checkmate-offshore-it-service-2-150x150.png 150w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<p>Please contact our <a href=\"https:\/\/www.checkmateq.com\/devops-engineering\">DevOps engineer<\/a> to discuss cloud infrastructure issues.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AWS Elastic Beanstalk is a cloud service provided by AWS using which you can quickly build and maintain apps in the AWS Cloud without needing to understand the infrastructure required to run those applications. It lessens the complexity of management without limiting choice or control. You only need to upload the application code and, Elastic &hellip; <a href=\"https:\/\/www.checkmateq.com\/blog\/node-js-application\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to deploy Node.js application with Elastic Beanstalk&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":3094,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[3,2,71,70,69,68,7,11],"_links":{"self":[{"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/posts\/3059"}],"collection":[{"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/comments?post=3059"}],"version-history":[{"count":16,"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/posts\/3059\/revisions"}],"predecessor-version":[{"id":4234,"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/posts\/3059\/revisions\/4234"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/media\/3094"}],"wp:attachment":[{"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/media?parent=3059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/categories?post=3059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.checkmateq.com\/blog\/wp-json\/wp\/v2\/tags?post=3059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}