Skip to content

Why AWS EC2 Stop Working When a Github Action Start?

0

I want to deploy following application on a AWS EC2 Instanc-

  1. Two Nextjs Application
  2. One Nestjs Application
  3. PostgreSQL Database

All the application is medium size application. For deploying this application-

I take AWS EC2 t2.2xlarge instance type which has 8vCPU and 32GB Memory. On this EC2 Instance, I deploy that two nextjs application and one nestjs application. I also install PostgreSQL for database on EC2. For automatic backing up, I am using cronjob and s3.

And I am using Github Self Hosted Actions for automatic deploy. I am facing that, when a github action is start to run, the whole EC2 instance stop working. All other sites not working, postgreSQL and nginx service getting stopped. Even In this moment, I can't connect to Terminal Both using SSH and Built In Terminal which we run on browser. I need to reboot the instance for re-working everything.

Note: It do not stop everytime. But If I push 5 times, it get failed 3 times, rest time it work fine.

I am not understanding, what is the problem.

  1. Is my t2.2xlarge is not enough?
  2. Or any configuration issues?

What instance type should I use?

Note: One my previous project I get same issue on t2.micro(1vCPU and 1GB Memory), and then I update it to t2.xlarge and then it does not the face that issues. On that project, I run two nextjs and one nestjs application.

asked 2 years ago545 views

1 Answer
0
Accepted Answer

Hello.

Is everything hosted on one EC2, including "Github Self Hosted Actions"?
In that case, please check the CPU usage rate and memory usage rate.
It is possible that EC2 is stopped due to high load.
Additionally, in the case of t2 instance types, when the CPU usage rate increases, CPU credits will be consumed and performance will temporarily increase.
However, once this CPU credit is used up, performance will drop to the baseline throughput, so performance will drop to the point where applications can hardly be used.
You may want to consider splitting your application across multiple EC2s or hosting your database on RDS.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html

EXPERT

answered 2 years ago

  • Yes, I host everything on single EC2! One suggestions should I upgrade to t3?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.