Stop or Terminate underutilized AWS resources
Cost Optimization Featured Workflow
Last updated
Cost Optimization Featured Workflow
Last updated
AWS Cost Optimization
Stop or Terminate underutilized AWS resources
If you have an underutilized EC2 instance, chances are you’re paying for nonproductive resources. AWS Trusted Advisor provides recommendations for different services that are either idle, unused, or over-provisioned. We found that even though AWS and other Cost management tools make it easy to identify these resources, the problem however is taking action on the recommendations. With Fylamynt we can automate the process of stopping or terminating these services.
Before we review the workflow let’s look at the different tools and integration required to make this happen. First off an AWS Target account has to be configured which provides no-code drag and drop ability to use AWS Execution action node and allows you to call any AWS API endpoint supported by the boto3 library. And lastly, we require a Slack integration that provides the ability to send messages and approval requests to your Slack Team.
Our example workflow retrieves all the recommendations, in JSON format, for services to be stopped or terminated from the Cost Optimization category of AWS Trusted Advisor however this Action Node can also be replaced by your favorite Cost Management Tool if it has the appropriate APIs available to retrieve this information.
The JSON output from Trusted Advisor is then used as the input for the JSONPATH action node which extracts the recommendations for each service using a Path Expression.
The workflow then transforms the JSON to string, and a message is sent to a specified Slack channel with variables listing the EC2 instance names that were identified with low utilization.
An approval request is then sent to a Slack channel to either stop or terminates the identified services based on the subsequent action node. In our workflow we monitoring the following services for cost savings however this can easily be replaced with other recommendations that might be applicable to your environment.
Stopping EC2 instances with low utilization
Deleting of EBS volumes with low utilization with an EC2 volume snapshot taken prior to termination
Deleting all Elastic IPs with low utilization
Stopping all idle RDS DB instances
If a user approves the request in the Slack channel the workflow executes the task against the recommended instances. Our example workflow does not have a trigger to automatically execute it, but through Fylamynt’s Task Manager a recurring schedule can be configured.