-1

I have three high processing machines running on AWS. Our engineers run specific applications on it that requires like 192 GB of RAM. Main idea behind this is after they start processing the job, no one is actually attending to server. so when job is finished the server keeps on running hence a costly bill. Is there a powershell script that can be used to shutdown the server when there are no apps running in server or maybe there is way in AWS to achieve this?

1 Answers1

1

Shutting down (as in shutdown -h now) the VM instance on AWS is not enough to stop amazon from billing you. You will have to "stop" the instance.

The other way round works: 'stopping' an instance shuts down the OS almost instantly.

So you, most likely, want to write a script, that is running your checks (like checking ram usage) and "stop" the AWS instance when the triggers are met.

I'd recommend to use the Get-CIMInstance commandlet and the AWSPowerShell Module to stop your instance.

Get the free physical memory in PowerShell

(Get-CIMInstance Win32_OperatingSystem).FreePhysicalMemory

Stop (and shutdown) a AWS instance:

Stop-EC2Instance -InstanceId i-123123123
bjoster
  • 4,805
  • 5
  • 25
  • 33