Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
can you scale down desiredcount to 0 via same container in fargate

I have a fargate service where a task running a container. So, my container is a custom made pipeline, which runs based on SQS count. So, if all the records are processed then I stop the pipeline from the container. So, what I'm wondering, instead of stopping the pipeline, can I set the desired count of the service to 0?(this service is the parent of this container's task)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Yes, you can set desire count to zero once the process complete, but there are few things that you need to consider.

  • Your node process should exit once it complete operation
  • Dockerfile should have a valid entrypoint, aws-cli
  • Fargate service should have to ecs service update opertation

For example Dockerfile

FROM node:alpine
RUN apk add --no-cache python py-pip

RUN pip install awscli
RUN aws --version
WORKDIR /app
COPY app.js .
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT /entrypoint.sh

entrypoint that will deal with nodejs process and set service count to 0 when the nodejs process completed from SQS.

#!/bin/sh
# start the node process, but it should exit once it processes all SQS
node app.js
# once process is done, we are good to scale down the service
aws ecs update-service --cluster my-cluster --region us-west-2 --service my-http-service --desired-count 0

An example node process that will exit after 1 minute, app.js

function intervalFunc() {
  console.log('Container will stop  in 1 minutes');
}

setInterval(intervalFunc, 1500);
setTimeout((function() {
    return process.exit(0);
}), 60000);

So Docker image play an important role and the node process should exit otherwise it will keep running.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!