Rightsizing EC2 instances
Cost Optimization Featured Workflow

Category:

AWS Cost Optimization

Workflow name:

Rightsizing EC2 instances

Description:

If you have overprovisioned EC2 instances, chances are you’re paying for resources you do not need. AWS Cost Management provides rightsizing recommendations for greater cost and usage efficiencies by reviewing your historical EC2 usage. We found that even though AWS and Cost Management Tools make it easy to identify the new EC2 instance types, the problem however is taking action on the recommendations. When rightsizing EC2 there are many factors to take into consideration and we love to work with you defining those for your specific situation.

Integrations:

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.

Workflow review:

Our example workflow retrieves all the EC2 rightsizing recommendations from AWS Cost Management however this can also be replaced by your favorite Cost Management Solutions if it has the appropriate APIs available to retrieve this information.
The recommendations MapList output from Trusted Advisor is then used as the input for the JSONPATH action node which extracts the instance ID and recommended new instance type for each EC2 instance 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 recommendations and recommended sizes.
An approval request is then sent to a Slack channel to resize the instance.
If a user approves the request the workflow stops the EC2 instance using the AWS Execution action node.
The workflow then waits for the stop process to complete, and using the EC2 Resize Instances action node the instance type of the EC2 is changes to the recommended type.
The workflow succeeds if the execution status of the resize action node returns an OK condition.
Our example workflow does not have a trigger to automatically execute it, but through Fylamynt’s Task Manager a recurring schedule can be configured.
Last modified 11d ago