1

we would like to run a time consuming C++ build on an AWS EC2 Windows Server Instance with 16 vCPUs. Due to the high cost we would like this instance to - start - run the build - when build is complete (or stops due to an error), stop instance

I considered using alarms for that purpose, but the build process has parts where the CPU is not used much (e.g. uploading files where network is used but almost no CPU) and alarms can not handle checking for both CPU and network traffic (AND operator is missing).

Are there any other mechanisms I can use for idle detection? To some extend we can change our build scripts to send messages (e.g. network messages) to AWS.

1

You're going about this the wrong way - as you've discovered, performing shutdown tasks like this based on resource utilization is not the most reliable solution.

Instead, use a scheduled Lambda job (or a cron script running on another server somewhere) to detect when a build is needed, and then start up the server. Then for shutdown, give the instance an instance role with permissions to stop itself, and as a last step in your build process, the instance can use the AWS API to shut itself down.

2
  • I'm very new to AWS, but how would that shut it down when/if the build crashes? – Jakodns Aug 19 '16 at 12:00
  • That should be handled gracefully in the build script - catch whatever exception is causing it to crash and continue on with the shutdown command. – EEAA Aug 19 '16 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.