Optimizing AWS EC2 Instances
After the reporting tables have been updated with the analysis results, you can view the recommendation reports from the Densify Console. In addition, a comprehensive PDF report can be downloaded for each instance to supply supporting evidence for a recommendation; this can be reviewed by a system owner before approvals are given for the suggested changes.
Note: The AWS EC2 optimization opportunities dashboard in the Densify Console contains recommendations for all AWS accounts for which you have collected EC2 instance data (see
The diagram below provides an overview of the three major processes in Densify:
- Data Collection—Collect AWS data into Densify.
Use the Densify API or the Densify Console to initiate this process.
- Analysis—Analyze collected data based on pre-defined policies to make recommendations.
The analysis process is initiated automatically after data collection completes. Results can be immediately pulled from the Densify API or pushed to a webhook URI once the analysis is complete.
- Reporting Database Update—Update reporting database tables with analysis results for reporting.
The reporting database update process is scheduled to run nightly after the analysis process. The Densify Console optimization opportunity reports and the Impact Analysis and Recommendation reports are available after the reporting database update is complete.
Note: Before you can collect data via AWS CloudWatch API, you need to create and configure an IAM role for Densify to have a trust relationship with your AWS account. See
The steps below outline a typical API workflow to optimize AWS EC2 instances:
- Authenticate using JWT—Retrieve token to authenticate each subsequent API call.
Optional: Review Policy—Review a list of available policies to be used for analysis.
Collect Data and Analyze—Start collecting data and initiate analysis (specify optional policy, optional webhook URI).
Check for Analysis Status—Check for data collection and analysis status or wait for a webhook trigger to indicate that the analysis finished and downstream processing has initiated.
Download EC2 Recommendations for Action—Retrieve recommendations for actioning or forward to orchestration engine.
- Optional: Download Impact Analysis and Recommendation Instance Report for system owners.
Follow the steps below to use the downloaded Postman collection:
- Unzip the downloaded file and import it into your Postman application. The Densify API Collection (12.1.7) collection and Densify environment are loaded into your Postman workspace.
- Modify the variables in the Densify environment to match your Densify and cloud-specific settings and credentials.
- Review the Documentation section of the collection for an overview of the workflow and API requests.
Note: If you already have a previous Densify environment in your Postman application, you can either delete the previous version or rename it. Otherwise, you will have duplicate Densify environments after the new collection is imported.
Use this sample collection to familiarize yourself with Densify API requests.
Use the /authorize resource to retrieve an authenticated token to make subsequent API calls. See Authorize for details. By default, the token expires in 5 minutes, therefore you will need to ensure that you have an active token for each Densify API request.
"expires" : 1542652705869,
"status" : 200
Use the apiToken value in your Authorization request header for subsequent Densify API calls.
Use the /analysis/cloud/aws/policy resource to view a list of policies available in Densify. You can use one of these policies for optimization analysis. This is an optional step as the analysis runs with the default policy if no policy is specified. See GET /analysis/cloud/aws/policy for details.
"description": "This policy is intended for generating instance sizing and instance family optimization recommendations that require little or no review before being implemented. Densify utilizes rule-driven analytics to predict the effort of changing instance type from current to recommended, and this policy favors Low effort recommendations, producing higher automation at the expense of lower cost savings.\r\nThe resource utilization of each system is modeled using a minimum of 7 days and up to 90 days of historical workload.\r\nWhen optimizing instance sizes and families, the predicted CPU and memory usage must not exceed 65% and 85%, respectively.\r\nThis policy will not specify burstable (T-series) instance families for workloads unless they are already running in a burstable family and will not change CPU Architecture from Intel to AMD or vice versa.\r\nWhen memory usage metrics are not available, the analysis assumes the existing memory allocation is required and will not change the memory configuration."
"description": "This policy reflects best practices for generating instance sizing and instance family optimization recommendations.\r\nThe resource utilization of each system is modeled using a minimum of 7 days and up to 60 days of historical workload.\r\nWhen optimizing instance sizes and families, the predicted CPU and memory usage levels must not exceed 70% and 90%, respectively.\r\nWhen memory usage metrics are not available, the analysis effectively assumes the existing memory allocation of the instance is required and will not change the memory configuration."
Initiate data collection and analysis for a given AWS account using the /analysis/cloud/aws/analyze resource. See Analysis: AWS Analyze for details.
You can specify an override policy to use for your analysis and/or specify a webhook to publish results when analysis is complete.
"href": "Not available"
"message": "Analysis in progress",
To find your AWS analysis entity, request for a list of existing AWS analyses available. Refer to List all analyses for a particular platform and vendor for details.
Use the "analysisStatus" resource element from the analysis entity to check for progress status. See Analysis: Status for details on this resource.
The analysis is complete and recommendations are available when "analysisStage": "Completed".
Use the /analysis/cloud/aws/<analysisId>/results resource to retrieve EC2 recommendation results and forward them to a downstream orchestration engine for actioning. See Analysis: AWS Recommendations for details.
Authorization: Bearer <apiToken>
Note: This request returns low-effort EC2 recommendations only for the account defined in the specified analysis (analysisId=9a5d2d55-6d85-4fde-8bab-fcd0cef8c5bf). If you want all EC2 recommendations for your Densify collected AWS infrastructure, you must accumulate the EC2 request results for all AWS analysis entities available in Densify.
Use the rptHref resource element provided in the JSON recommendation output to download a PDF Impact Analysis and Recommendation Report for each instance. This report is available after a reporting database update, which is scheduled to run nightly. See rptHref and Example: Downloading an Impact Analysis and Recommendation Report for details.