简体   繁体   中英

EC2 freeze on installing NodeJS packages NPM/Yarn - AWS

I am deploying a React + Express API app in EC2 t2-micro - Ubuntu with NGINX The problem is when I try npm i ( node_modules is not uploaded), the server freeze and I need to restart it. There is no response from SSH/FTP/HTTP. Via HTTP I am getting 504 timed out .

In EC2 AWS Dashboard -> Monitoring, I see:

在此处输入图像描述

This is the system log :

[ 15.627070] cloud-init[847]: Cloud-init v. 20.3-......ubuntu1~20.04.1 finished at Fri, 22 Jan 20..... Datasource DataSourceEc2Local. Up 15.60 seconds 20...: Amazon SSM Agent v3.0.161.0 is running 20....: OsProductName: Ubuntu 202....: OsVersion: 20.04

The Instance Screenshot works fine and I see the login console: 在此处输入图像描述

The Status Checks are passed and there is no failed at all. It is the same after 30 mins.

In the same time I can't access it via HTTP ( 504 error ) or via SSH with Putty, where I see just an empty console with no symbols.

I have Credit specification - Enabled unlimited mode .

I think, this is about the CPU usage/credits, but I don't know, how to figure out everything. I can increase the instance type, but is it this the only solution? For t2-micro , we are using a free tier .

fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap  /swapfile
swapon /swapfile
swapon  --show
free -h

Found this answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM