Can ECS Tasks Start on Demand Like Lambda for PR Environments?

0
0
Asked By CuriousCoder92 On

Hey everyone,

I've got a huge codebase (700k lines!) that we're managing with ECS in production. We're planning to create a separate environment for each pull request but we want to keep costs down by not having these environments running all the time.

What I'm looking for is a way to automatically spin up an ECS task when someone visits the environment URL. Is that doable? Lambda is off the table for us since we want to maintain as close to production as possible, and our backend is Node.js with a lot of async functions.

3 Answers

Answered By CloudSailor76 On

Definitely check out the ECS preview environment feature that AWS offers. It might align perfectly with what you're needing: https://aws.amazon.com/blogs/containers/build-preview-environments-for-amazon-ecs-applications-with-aws-copilot/

Answered By ECSGuru88 On

You could actually set up a system where the PR itself controls the uptime of the environment. So, when a PR is opened, you deploy the environment, and when it's closed, you take it down. If it sits for too long, you could scale it down to zero to save costs.

PRTechie34 -

Exactly! You could use a Terraform module to create the environment with unique tags based on the commit hash too. Just do a plan/apply, run your tests, then tf destroy when done.

TesterNinja21 -

That sounds great, but our QA team usually takes a while to start testing. It would be perfect if it could spin up automatically when a tester hits the URL instead of needing a manual trigger.

Answered By BudgetBee99 On

Is keeping one ECS task running all the time really too expensive? It might simplify your workflow, especially if QA takes a while. But, I get that you're looking to save wherever you can.

CuriousCoder92 -

Yeah, we just have too many PRs open at a time. Our QA engineers often take a whole week to get to a ticket, so it's really not efficient for us to leave everything running.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.