{"id":1180,"date":"2023-12-07T14:14:31","date_gmt":"2023-12-07T14:14:31","guid":{"rendered":"http:\/\/oqtacore-blog-473533498.us-east-1.elb.amazonaws.com\/?p=1180"},"modified":"2024-04-02T16:38:52","modified_gmt":"2024-04-02T16:38:52","slug":"moving-a-monorepo-from-amplify-to-beanstalk","status":"publish","type":"post","link":"https:\/\/oqtacore.com\/blog\/moving-a-monorepo-from-amplify-to-beanstalk\/","title":{"rendered":"Moving a monorepo from AWS Amplify to AWS Beanstalk"},"content":{"rendered":"<p>AWS Amplify is an amazing tool for publishing next.js websites when you are starting a new project.<\/p>\n<p>However, if you continue growing your web portal, there will be a moment when Amplify will fail building due to final build size being to big.<\/p>\n<p>You can postpone this moment by optimizing your node_modules and win 3-6 months, but the ending is inevitable &#8211; you will have to move you project to either EKS or Beanstalk.<\/p>\n<p>We prefer Beanstalk for our own reasons &#8211; Docker+k8s seems to be an extra abstraction on top of AWS&#8217;s abstraction. Kubernetes makes a cloud from your on-premise data center, but AWS is a cloud by itself already. Beanstalk is basically a managed Kubernetes, so why make life harder? Code Pipeline and Beanstalk provide a great way to control the deployed build versions, as well as other great tools in terms of monitoring, alerts and costs management.<\/p>\n<p>So, here is a step-by-step instruction for deploying a monorepository on next.js@12.0.7 on elastic beanstalk and assembly on AWS Code Pipeline<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Project_information\"><\/span><a id=\"post-1180-_v0zjusqx2oji\"><\/a><strong>Project information<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>Next.js version 12.0.7<\/li>\n<li>Node.js 16.18.1<\/li>\n<li>Yarn 1.22.9<\/li>\n<li>NPM 8.19.2<\/li>\n<li>Monorepository<\/li>\n<li>Environment for running commands:cli.sh<\/li>\n<li>The volume of the final assembly is 700mb<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Creating_elastic_beanstalk\"><\/span><a id=\"post-1180-_o1b7f8nh20l5\"><\/a>Creating elastic beanstalk<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>Select the region we need in which we will deploy our application<\/li>\n<li>Go to the page<a href=\"https:\/\/us-east-1.console.aws.amazon.com\/elasticbeanstalk\/home?region=us-east-1#\/applications\" target=\"_blank\" rel=\"noopener\">elastic beanstalk in the applications tab<\/a><\/li>\n<li>If necessary, create a new application by clicking on the Create application button<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"199\" class=\"wp-image-1181\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-1.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-1.png 2048w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-1-300x29.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-1-1024x100.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-1-768x75.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-1-1536x149.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-1-180x17.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-1-800x78.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-1-1600x155.png 1600w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<ol>\n<li>Enter a name and click the Create button<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"963\" class=\"wp-image-1182\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-2.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-2.png 2048w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-2-300x141.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-2-1024x482.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-2-768x361.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-2-1536x722.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-2-180x85.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-2-800x376.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-2-1600x752.png 1600w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<ol>\n<li>When you click on the application name, go to the tab<a href=\"https:\/\/us-east-1.console.aws.amazon.com\/elasticbeanstalk\/home?region=us-east-1#\/environments\" target=\"_blank\" rel=\"noopener\">Environments<\/a>.<\/li>\n<li>Click the Create new environment button<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"193\" class=\"wp-image-1183\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-3.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-3.png 2048w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-3-300x28.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-3-1024x97.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-3-768x72.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-3-1536x145.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-3-180x17.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-3-800x75.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-3-1600x151.png 1600w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<ol>\n<li>We put down the configuration as in the screenshot<\/li>\n<li>Application name will be selected automatically if you clicked on the name in the applications tab<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1638\" height=\"1068\" class=\"wp-image-1184\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-4.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-4.png 1638w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-4-300x196.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-4-1024x668.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-4-768x501.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-4-1536x1001.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-4-180x117.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-4-800x522.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-4-1600x1043.png 1600w\" sizes=\"auto, (max-width: 1638px) 100vw, 1638px\" \/><\/p>\n<ol>\n<li>Enter yourEnvironment name. Enter your temporary Domain name and check its availability using the Check availability button<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"916\" class=\"wp-image-1185\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-5.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-5.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-5-300x168.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-5-1024x574.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-5-768x431.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-5-1536x861.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-5-180x101.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-5-800x448.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-5-1600x897.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>For version next.js@12.0.7, you must install version Node.js 16 (this must be observed when creating any environments for version next.js@12.0.7)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1632\" height=\"1144\" class=\"wp-image-1186\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-6.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-6.png 1632w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-6-300x210.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-6-1024x718.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-6-768x538.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-6-1536x1077.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-6-180x126.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-6-800x561.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-6-1600x1122.png 1600w\" sizes=\"auto, (max-width: 1632px) 100vw, 1632px\" \/><\/p>\n<ol>\n<li>Next, leave the checkboxes as in the screenshot and move on to the next step by clicking on the Next button<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1632\" height=\"1070\" class=\"wp-image-1187\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-7.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-7.png 1632w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-7-300x197.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-7-1024x671.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-7-768x504.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-7-1536x1007.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-7-180x118.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-7-800x525.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-7-1600x1049.png 1600w\" sizes=\"auto, (max-width: 1632px) 100vw, 1632px\" \/><\/p>\n<ol>\n<li>Next, in the screenshot, select the roles that beanstalk offers us (as in the screenshot below). We do not change them, as the application will launch with an error. If you are creating these roles for the first time, you must refer to the AWS service role instructions.<\/li>\n<li>Next, click the Next button and move on to the next step.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1632\" height=\"1330\" class=\"wp-image-1188\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-8.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-8.png 1632w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-8-300x244.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-8-1024x835.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-8-768x626.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-8-1536x1252.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-8-180x147.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-8-800x652.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-8-1600x1304.png 1600w\" sizes=\"auto, (max-width: 1632px) 100vw, 1632px\" \/><\/p>\n<ol>\n<li>Next, select the configured VPC. If your VPC does not already exist, you need to create a new one by clicking on the Create custom VPC button and refer to the AWS VPC documentation<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"588\" class=\"wp-image-1189\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-9.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-9.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-9-300x108.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-9-1024x368.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-9-768x276.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-9-1536x553.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-9-180x65.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-9-800x288.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-9-1600x576.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>Select the Activated option for the Public IP address. We also select all available regions<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"1038\" class=\"wp-image-1190\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-10.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-10.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-10-300x191.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-10-1024x650.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-10-768x488.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-10-1536x976.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-10-180x114.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-10-800x508.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-10-1600x1016.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>Select all available regions for the database. We leave the remaining options in the Database section unchanged.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"1000\" class=\"wp-image-1191\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-11.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-11.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-11-300x184.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-11-1024x627.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-11-768x470.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-11-1536x940.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-11-180x110.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-11-800x490.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-11-1600x979.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>Next, click the Next button to move to the next stage<\/li>\n<li>Depending on the volume of the finished assembly of your project, select the SSD used. In this example, we use a monorepository, the volume of the final assembly is ~700mb (excluding node_modules)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"1152\" class=\"wp-image-1192\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-12.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-12.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-12-300x212.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-12-1024x722.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-12-768x541.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-12-1536x1083.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-12-180x127.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-12-800x564.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-12-1600x1128.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>Leave the rest of the options as they are.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"680\" class=\"wp-image-1193\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-13.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-13.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-13-300x125.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-13-1024x426.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-13-768x320.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-13-1536x639.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-13-180x75.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-13-800x333.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-13-1600x666.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>Next, select the pre-configured EC2 security group. If this is your first time creating a beanstalk, please refer to the AWS documentation on creating an ec2 security group<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"1152\" class=\"wp-image-1194\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-14.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-14.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-14-300x212.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-14-1024x722.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-14-768x541.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-14-1536x1083.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-14-180x127.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-14-800x564.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-14-1600x1128.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>Next, from the Environment type drop-down list, select Load Balanced and the Combine purchase options and instances option<\/li>\n<li>Leave the remaining options unchanged<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"1000\" class=\"wp-image-1195\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-15.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-15.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-15-300x184.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-15-1024x627.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-15-768x470.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-15-1536x940.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-15-180x110.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-15-800x490.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-15-1600x979.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>We choose x86_64 architecture. AND<a href=\"https:\/\/aws.amazon.com\/ru\/ec2\/pricing\/on-demand\/\" target=\"_blank\" rel=\"noopener\">select the instance type<\/a> from the requirements of our project. For a testing\/development bench we will need 2 CPUs and 4gb of memory. You can also customize your instance to your needs and select it in the AMD ID, but to do this, refer to the AWS AMD ID documentation.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"1420\" class=\"wp-image-1196\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-16.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-16.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-16-300x261.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-16-1024x890.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-16-768x667.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-16-1536x1335.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-16-180x156.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-16-800x695.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-16-1600x1390.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>We leave the remaining options unchanged.<\/li>\n<li>Next, select all available regions<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"1108\" class=\"wp-image-1197\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-17.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-17.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-17-300x203.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-17-1024x694.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-17-768x521.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-17-1536x1042.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-17-180x122.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-17-800x542.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-17-1600x1085.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>Next, select everything as in the screenshot, and we will return to the listeneres stage at the very end of our instructions<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1634\" height=\"1346\" class=\"wp-image-1198\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-18.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-18.png 1634w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-18-300x247.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-18-1024x844.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-18-768x633.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-18-1536x1265.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-18-180x148.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-18-800x659.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-18-1600x1318.png 1600w\" sizes=\"auto, (max-width: 1634px) 100vw, 1634px\" \/><\/p>\n<ol>\n<li>If we want to use a different port when listening to an application, we add it by clicking on the Add process button. Within the framework of this instruction, we will not consider this stage, since by default Beanstalk looks for the command in package.json<strong>npm start<\/strong> <a href=\"https:\/\/docs.aws.amazon.com\/elasticbeanstalk\/latest\/dg\/create_deploy_nodejs.container.html\" target=\"_blank\" rel=\"noopener\">(more details here)<\/a> and runs it on its default port 8080. This port can be changed by creating a global variable PORT at the last stage of beanstalk configuration. You can check the working port:\n<ol>\n<li>Go to the ec2 instance tab<\/li>\n<li>Find the name by our Environment name<\/li>\n<li>Click the Connect button at the top<\/li>\n<li>Login to an instance from the selected 4 connection options (depending on the instance type created, only one login may be available)<\/li>\n<li>Using the command line, we view the application launch ports used<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1630\" height=\"1372\" class=\"wp-image-1199\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-19.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-19.png 1630w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-19-300x253.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-19-1024x862.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-19-768x646.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-19-1536x1293.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-19-180x152.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-19-800x673.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-19-1600x1347.png 1600w\" sizes=\"auto, (max-width: 1630px) 100vw, 1630px\" \/><\/p>\n<ol>\n<li>Leave the remaining options unchanged and click Next.<\/li>\n<li>We do not consider the following steps for setting up beanstalk within the framework of this instruction because they remain unchanged. At this point you can just add a global PORT variable to configure your application<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Creating_codePipeline_part_12\"><\/span><a id=\"post-1180-_ggttqg1iq73g\"><\/a>Creating codePipeline part 1\/2<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>Go to the creation page<a href=\"https:\/\/us-east-1.console.aws.amazon.com\/codesuite\/codepipeline\/pipelines?region=us-east-1&amp;pipelines-meta=eyJmIjp7InRleHQiOiIifSwicyI6eyJwcm9wZXJ0eSI6InVwZGF0ZWQiLCJkaXJlY3Rpb24iOi0xfSwibiI6MTAsImkiOjB9\" target=\"_blank\" rel=\"noopener\">pipeline<\/a>. And click the Create Pipeline button<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"261\" class=\"wp-image-1200\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-20.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-20.png 2048w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-20-300x38.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-20-1024x131.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-20-768x98.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-20-1536x196.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-20-180x23.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-20-800x102.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-20-1600x204.png 1600w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<ol>\n<li>Enter the name of your new pipeline. Service role should be created automatically. Next, click Next<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1682\" height=\"1306\" class=\"wp-image-1201\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-21.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-21.png 1682w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-21-300x233.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-21-1024x795.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-21-768x596.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-21-1536x1193.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-21-180x140.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-21-800x621.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-21-1600x1242.png 1600w\" sizes=\"auto, (max-width: 1682px) 100vw, 1682px\" \/><\/p>\n<ol>\n<li>Next, select Github (Version 2) from the drop-down list. We select a pre-created Connection Github from the list that has access to the GitHub repository of our project. Next, select the names and branch. If you have not created a Connection, please refer to the AWS Connection GitHub documentation. Next, click Next.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1222\" height=\"1598\" class=\"wp-image-1202\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-22.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-22.png 1222w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-22-229x300.png 229w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-22-783x1024.png 783w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-22-768x1004.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-22-1175x1536.png 1175w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-22-180x235.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-22-800x1046.png 800w\" sizes=\"auto, (max-width: 1222px) 100vw, 1222px\" \/><\/p>\n<ol>\n<li>Next, select AWS CodeBuild from the Build Provider drop-down list. Select the desired region. And click Create Project. We also set global variables and later we will return to continue building the Code Pipeline<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1472\" height=\"1466\" class=\"wp-image-1203\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-23.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23.png 1472w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-300x300.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-1024x1020.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-150x150.png 150w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-768x765.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-180x179.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-800x797.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-223x223.png 223w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-24x24.png 24w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-48x48.png 48w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-23-96x96.png 96w\" sizes=\"auto, (max-width: 1472px) 100vw, 1472px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Creating_a_Build_Project\"><\/span><a id=\"post-1180-_o05tpr4wkrqf\"><\/a>Creating a Build Project.<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>After clicking Create Project, the Build Project configuration interface opens and enter Project Name<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1472\" height=\"950\" class=\"wp-image-1204\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-24.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-24.png 1472w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-24-300x194.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-24-1024x661.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-24-768x496.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-24-180x116.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-24-800x516.png 800w\" sizes=\"auto, (max-width: 1472px) 100vw, 1472px\" \/><\/p>\n<ol>\n<li>Next, select Linux 2. And the parameters are as in the screenshot below. Be sure to select the standard:4.0 version since the standard:5.0 build version will not run for our environment and build.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1472\" height=\"1212\" class=\"wp-image-1205\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-25.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-25.png 1472w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-25-300x247.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-25-1024x843.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-25-768x632.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-25-180x148.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-25-800x659.png 800w\" sizes=\"auto, (max-width: 1472px) 100vw, 1472px\" \/><\/p>\n<ol>\n<li>Leave the options as default<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1472\" height=\"362\" class=\"wp-image-1206\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-26.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-26.png 1472w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-26-300x74.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-26-1024x252.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-26-768x189.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-26-180x44.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-26-800x197.png 800w\" sizes=\"auto, (max-width: 1472px) 100vw, 1472px\" \/><\/p>\n<ol>\n<li>We increase the configuration of the temporary build environment to 7 GB of memory and 4 CPU<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1472\" height=\"1230\" class=\"wp-image-1207\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-27.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-27.png 1472w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-27-300x251.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-27-1024x856.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-27-768x642.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-27-180x150.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-27-800x668.png 800w\" sizes=\"auto, (max-width: 1472px) 100vw, 1472px\" \/><\/p>\n<ol>\n<li>Next, leave the selected parameters as default and click Next.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1472\" height=\"1516\" class=\"wp-image-1208\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-28.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-28.png 1472w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-28-291x300.png 291w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-28-994x1024.png 994w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-28-768x791.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-28-180x185.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-28-800x824.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-28-24x24.png 24w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-28-48x48.png 48w\" sizes=\"auto, (max-width: 1472px) 100vw, 1472px\" \/><\/p>\n<ol>\n<li>The codeBuild stage is complete. Let&#8217;s return to further configuration of Pipeline<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Creating_codePipeline_part_22\"><\/span><a id=\"post-1180-_rj19k269ytot\"><\/a>Creating codePipeline part 2\/2<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>After successfully creating a Build Project, the name of the created configuration will be highlighted in the name field and click the Next button<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1472\" height=\"852\" class=\"wp-image-1209\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-29.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-29.png 1472w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-29-300x174.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-29-1024x593.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-29-768x445.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-29-180x104.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-29-800x463.png 800w\" sizes=\"auto, (max-width: 1472px) 100vw, 1472px\" \/><\/p>\n<ol>\n<li>Next, select the Elastic Beanstalk option from the Deploy Provider drop-down list. Next, from the list, select Application name, the name of our environment that we created at the Beanstalk configuration stage. Next, select the name of the created application and click Next.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1472\" height=\"934\" class=\"wp-image-1210\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-30.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-30.png 1472w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-30-300x190.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-30-1024x650.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-30-768x487.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-30-180x114.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-30-800x508.png 800w\" sizes=\"auto, (max-width: 1472px) 100vw, 1472px\" \/><\/p>\n<ol>\n<li>At this point, the codePipeline setup is complete<\/li>\n<li>Now we can observe the running assembly of our application<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"1196\" class=\"wp-image-1211\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-31.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-31.png 2048w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-31-300x175.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-31-1024x598.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-31-768x449.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-31-1536x897.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-31-180x105.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-31-800x467.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-31-1600x934.png 1600w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<ol>\n<li>But to successfully build the application, you need to add the build configuration configuration (buildspec.yml) for the pipeline and the deploy configuration for beanstalk (installation of yarn and other packages to successfully launch the next.js application)<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Configuration_files_for_pipeline_Buildspecyml_clish\"><\/span><a id=\"post-1180-_xpk797sf60n1\"><\/a>Configuration files for pipeline (Buildspec.yml &amp; cli.sh)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>We create a buildspec.yml file in the root of our project. At the build stage\n<ol>\n<li>We create global variables<\/li>\n<li>Call the command from cli.sh &#8211; deploy_app<\/li>\n<li>We remove node_modules and .next\/cache in order to facilitate the deployment stage on instace beanstalka, since there are memory limits of ~500mb<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>version: 0.2<\/p>\n<p>phases:<\/p>\n<p>install:<\/p>\n<p>runtime-versions:<\/p>\n<p>nodejs: 16<\/p>\n<p>commands:<\/p>\n<p>&#8211; n 16.18.1<\/p>\n<p>pre_build:<\/p>\n<p>commands:<\/p>\n<p>&#8211; echo &#8220;preBuild APP&#8221;<\/p>\n<p>&#8211; rm -rf node_modules **\/node_modules<\/p>\n<p>&#8211; npm cache clean &#8211;force<\/p>\n<p>&#8211; yarn cache clean<\/p>\n<p>&#8211; yarn install &#8211;frozen-lockfile<\/p>\n<p>&#8211; yarn global add next@12.0.7<\/p>\n<p>build:<\/p>\n<p>commands:<\/p>\n<p>&#8211; NAME_VARIABLE_IN_APP=${NAME_VARIABLE_IN_PIPELINE}<\/p>\n<p>&#8211; echo &#8220;Build APP&#8221;<\/p>\n<p>&#8211; pwd<\/p>\n<p>&#8211; .\/cli.sh deploy_app<\/p>\n<p>&#8211; rm -rf node_modules<\/p>\n<p>&#8211; rm -rf .next\/cache<\/p>\n<p>artifacts:<\/p>\n<p>files:<\/p>\n<p>&#8211; &#8216;**\/*&#8217;<\/p>\n<p>discard-paths: no<\/p>\n<p>cache:<\/p>\n<p>paths:<\/p>\n<p>&#8211; node_modules\/**\/*<\/p>\n<ol>\n<li>Create a cli.sh file in the root of our project\n<ol>\n<li>In the deploy_app function we add the \u2018set -e\u2019 command, since during the build pipeline stage, errors that occur during our npm run build command are not processed by the pipeline and go to the next pipeline deploy stage<\/li>\n<li>This instruction does not cover setting up the cli.sh file; to do this, contact a search engine or chatGPT<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>deploy_app() {<\/p>\n<p>set -It is<\/p>\n<p>echo &#8220;START npm run build mode&#8221;<\/p>\n<p>node -in<\/p>\n<p>npm -in<\/p>\n<p>echo &#8216;AMPLIFY_ENV: &#8216; + $NEXT_PUBLIC_AMPLIFY_ENV<\/p>\n<p>npm run build &#8211;workspace=@name_project\/app<\/p>\n<p>}<\/p>\n<ol>\n<li>The creation and preparation of files at the pipeline stage is completed<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Configuration_files_for_elastic_beanstalk_sh_file_packagejson\"><\/span><a id=\"post-1180-_k2ax2qpjeypu\"><\/a>Configuration files for elastic beanstalk (.sh file &amp; package.json)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>We create a directory .platform\/hooks\/prebuild\/ in the root of our project with the file yarn.sh\n<ol>\n<li>You can learn more about hooks and instance beanstalk configuration in<a href=\"https:\/\/docs.aws.amazon.com\/elasticbeanstalk\/latest\/dg\/platforms-linux-extend.html\" target=\"_blank\" rel=\"noopener\">official AWS documentation<\/a><\/li>\n<li>First, we install node.js of the required version (_16.x is the required syntax for downloading the version) since node.js is not yet available at the prebuild stage.<\/li>\n<li>Next we install yarn and initialize it for global access<\/li>\n<li>Next, using yarn, we install next.js of the required version<\/li>\n<li>And if you are using the env-cmd package to work with global variables<\/li>\n<li>Next, we re-install all package dependencies of our project, since at the build stage in the builddpec.yml file we removed the deploy pipeline stage for proper operation<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><strong>#!\/bin\/bash<\/strong><\/p>\n<p>echo &#8220;install node.js&#8221;<\/p>\n<p>sudo curl &#8211;silent &#8211;location https:\/\/rpm.nodesource.com\/setup_16.x | sudo bash &#8211;<\/p>\n<p>sudo yum -y install nodejs<\/p>\n<p>sudo wget https:\/\/dl.yarnpkg.com\/rpm\/yarn.repo -O \/etc\/yum.repos.d\/yarn.repo<\/p>\n<p>sudo yum -y install yarn<\/p>\n<p>export PATH=&#8221;$PATH:$HOME\/.yarn\/bin&#8221;<\/p>\n<p>source ~\/.bashrc<\/p>\n<p>cd \/var\/app\/staging\/<\/p>\n<p>sudo yarn global add next@12.0.7<\/p>\n<p>sudo yarn global add env-cmd<\/p>\n<p>sudo chown -R webapp:webapp node_modules\/ || true<\/p>\n<p>sudo yarn install &#8211;frozen-lockfile<\/p>\n<ol>\n<li>I assume that you already have a package.json file in the root directory because it should be your default when working with next.js. It must contain the npm start command<\/li>\n<\/ol>\n<p>&#8220;scripts&#8221;: {<\/p>\n<p>&#8220;start&#8221;: &#8220;npm run start &#8211;workspace=@name-project\/app&#8221;<\/p>\n<p>}<\/p>\n<ol>\n<li>Now we push all the changes to the github repository and the pipeline assembly should start again<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><a id=\"post-1180-_fxhlybo3dg0n\"><\/a>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>We return to codePipeline. We are waiting for the completion of the build stage. If the build was not successful, you can view the logs by clicking on the View logs button at the build stage and scroll to the end.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"1019\" class=\"wp-image-1212\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-32.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-32.png 2048w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-32-300x149.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-32-1024x510.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-32-768x382.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-32-1536x764.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-32-180x90.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-32-800x398.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-32-1600x796.png 1600w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<ol>\n<li>If the build stage was successful, then we have completed 80% of our journey successfully.<\/li>\n<li>If the deploy step fails with an error, you can get the deployed information in Beanstalk by opening your application environment and opening the Logs tab at the bottom (as in the screenshot below) and selecting Full from the drop-down list. And then download by clicking on the Download button. There are a lot of useful command line files and beanstalk hooks there. If this information is not enough, then we can go to the instance itself and try to run the project ourselves and check whether it will work on the temporary beanstalk domain. We discussed the step of how to log into ec2 instance in this instruction<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"1157\" class=\"wp-image-1213\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-33.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-33.png 2048w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-33-300x169.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-33-1024x579.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-33-768x434.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-33-1536x868.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-33-180x102.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-33-800x452.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-33-1600x904.png 1600w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<ol>\n<li>If the deploy was successful, then we return to our environment elastic beanstalk<\/li>\n<li>And click the link to our temporary domain<\/li>\n<li>The application will open. If this does not happen, check the logs, the port on which the application is launched and try to go to your ec2 instance and run your assembly on port 8080 yourself.<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"How_can_you_make_the_application_available_via_https\"><\/span><a id=\"post-1180-_ld7odu3fokrx\"><\/a>How can you make the application available via https?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>We purchase domain, if you don&#8217;t have it yet, for this use the AWS documentation (Route53)<\/li>\n<li>It will help you get a certificate<a href=\"https:\/\/us-east-1.console.aws.amazon.com\/acm\/home?region=us-east-1#\/welcome\" target=\"_blank\" rel=\"noopener\">AWS Certificate Manager<\/a>, a button to automatically add a DNS CNAME record to Route53 is also available there<\/li>\n<li>You need to register DNS records (CNAME) in Route53 and change the type A record with the alias option selected on Beanstalk<\/li>\n<li>And after that we return to Beanstalk. Open the Configuration tab. Find the Instance traffic and scaling section. Click on the Edit button<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"479\" class=\"wp-image-1214\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-34.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-34.png 2048w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-34-300x70.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-34-1024x240.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-34-768x180.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-34-1536x359.png 1536w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-34-180x42.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-34-800x187.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-34-1600x374.png 1600w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/p>\n<ol>\n<li>Find the Listeners section<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1518\" height=\"488\" class=\"wp-image-1215\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-35.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-35.png 1518w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-35-300x96.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-35-1024x329.png 1024w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-35-768x247.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-35-180x58.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-35-800x257.png 800w\" sizes=\"auto, (max-width: 1518px) 100vw, 1518px\" \/><\/p>\n<ol>\n<li>Click the Add listener button<\/li>\n<li>Enter port 443, select https, the SSL certificate created in step 2 and select the latest SSL policy. After that, save, scroll down and accept the changes.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1128\" height=\"1132\" class=\"wp-image-1216\" src=\"http:\/\/blog.oqtacore.com\/wp-content\/uploads\/2023\/12\/word-image-1180-36.png\" alt=\"\" srcset=\"https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36.png 1128w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-300x300.png 300w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-1020x1024.png 1020w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-150x150.png 150w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-768x771.png 768w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-180x181.png 180w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-800x803.png 800w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-223x223.png 223w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-24x24.png 24w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-48x48.png 48w, https:\/\/oqtacore.com\/blog\/wp-content\/uploads\/2023\/12\/word-image-1180-36-96x96.png 96w\" sizes=\"auto, (max-width: 1128px) 100vw, 1128px\" \/><\/p>\n<ol>\n<li>Congratulations, you have a working next.js project running on aws beanstalk + pipeline on https<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>AWS Amplify is an amazing tool for publishing next.js websites when you are starting a new project. However, if you continue growing your web portal, there will be a moment when Amplify will fail building due to final build size being to big. You can postpone this moment by optimizing your node_modules and win 3-6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_mo_disable_npp":"","yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1180","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":{"image":1223},"yasr_visitor_votes":{"number_of_votes":0,"sum_votes":0,"stars_attributes":{"read_only":false,"span_bottom":false}},"_links":{"self":[{"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/posts\/1180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/comments?post=1180"}],"version-history":[{"count":4,"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/posts\/1180\/revisions"}],"predecessor-version":[{"id":1224,"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/posts\/1180\/revisions\/1224"}],"wp:attachment":[{"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/media?parent=1180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/categories?post=1180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oqtacore.com\/blog\/wp-json\/wp\/v2\/tags?post=1180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}