BookmarkSubscribeRSS Feed
Calcite | Level 5

Hello SAS Community,


We are in the process of moving some services to the AWS cloud and have around 8 SAS instances running. Our goal is to create an automation script to shut these instances down during off-hours to save costs.




Here are a few specific questions we have:


  1. Shutdown Mechanism: When shutting down an EC2 instance using AWS commands, does it perform a graceful shutdown similar to a normal OS shutdown, or is it more like pulling the power cord?
  2. Shutdown Order: Is there a best practice for the order in which to shut down and start up instances? For example, should databases be shut down last and started first?
  3. Automation Tools: What are the recommended tools or methods for automating this process? We've looked into AWS Lambda and AWS Systems Manager but would appreciate guidance or examples.
  4. Handling Dependencies: How do we ensure that dependent services are shut down in the correct order to prevent issues?

Here is what we are currently considering:


  • Using AWS Lambda triggered by CloudWatch Events to stop instances.
  • Ensuring that our shutdown sequence handles dependencies correctly (e.g., web servers -> application servers -> databases).


Any insights, best practices, or sample scripts would be greatly appreciated!

Thanks in advance for your help!

Calcite | Level 5

Any idea anyone?


You could look at using SAS_lsm to manage gracefully shutting down the SAS 9 services in the correct order.


For Viya 3.x, there is viya-ark to do this:


For Viya 4, there is a supplied cronjob to stop Viya.

I'm on Azure and not AWS, but I use a scheduled script that runs a graceful stop of SAS services (like SAS_lsm on SAS 9 and viya-ark on Viya) and then stops and deallocates the VMs using the CLI (or in the case of Kuberentes, stops the cluster).

I expect that VM shutdown is graceful and not like pulling the power cord, though AWS support may be able to provide more detail on that functionality.

Greg Wootton | Principal Systems Technical Support Engineer

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1 like
  • 2 in conversation