Amazon Redshift is a quick, scalable, safe, and absolutely managed cloud information warehouse that allows you to analyze your information at scale. Amazon Redshift now means that you can programmatically entry Amazon Redshift Advisor suggestions by an API, enabling you to combine suggestions about the best way to enhance your provisioned cluster efficiency into your personal purposes.
Amazon Redshift Advisor affords suggestions about optimizing your Redshift cluster efficiency and helps you save on working prices. Advisor develops its custom-made suggestions by analyzing efficiency and utilization metrics to your cluster and shows suggestions that ought to have a major affect on efficiency and operations. Now, with the flexibility to programmatically entry these suggestions by the ListRecommendations API, you may make suggestions obtainable to implement on-demand or mechanically by your personal inside purposes and instruments with out the necessity to entry the Amazon Redshift console.
On this publish, we present you the best way to use the ListRecommendations API to arrange e-mail notifications for Advisor suggestions in your Redshift cluster. These suggestions, reminiscent of figuring out tables that must be vacuumed to kind the info or discovering desk columns which can be candidates for compression, will help enhance efficiency and save prices.
How one can entry Redshift Advisor suggestions
To entry Advisor suggestions on the Amazon Redshift console, select Advisor within the navigation pane. You may develop every advice to see extra particulars, and type and group suggestions.

You may also use the ListRecommendations API to automate receiving the Advisor suggestions and programmatically implement them. The API returns a listing of beneficial actions that may be parsed and applied. The API and SDKs additionally allow you to arrange workflows to make use of Advisor programmatically for automated optimizations. These automated periodic checks of Advisor utilizing cron scheduling together with implementing the adjustments will help you retain Redshift clusters optimized mechanically with out handbook intervention.
You may also use the list-recommendations command within the AWS Command Line Interface (AWS CLI) to invoke the Advisor suggestions from the command line and automate the workflow by scripts.
Answer overview
The next diagram illustrates the answer structure.

The answer workflow consists of the next steps:
- An Amazon EventBridge schedule invokes an AWS Lambda perform to retrieve Advisor suggestions.
- Advisor generates suggestions which can be accessible by an API.
- Optionally, this resolution shops the suggestions in an Amazon Easy Storage Service (Amazon S3) bucket.
- Amazon Easy Notification Service (Amazon SNS) mechanically sends notifications to end-users.
Stipulations
To deploy this resolution, it’s best to have the next:
Deploy the answer
Full the next steps to deploy the answer:
- For Stack title, enter a reputation for the stack, for instance, blog-redshift-advisor-recommendations.
- For SnsTopicArn, enter the SNS matter Amazon Useful resource Title (ARN) for receiving the e-mail alerts.
- For ClusterIdentifier, enter your Redshift cluster title if you wish to obtain Advisor notifications for a specific cluster. In the event you go away it clean, you’ll obtain notifications for all Redshift provisioned clusters in your account.
- For S3Bucket, enter the S3 bucket title to retailer the detailed Advisor suggestions in a JSON file. In the event you go away it clean, this step shall be skipped.
- For ScheduleExpression, enter the frequency in cron format to obtain Advisor advice alerts. For this publish, we need to obtain alerts each Sunday at 14:00 UTC, so we enter cron(0 14 ? * SUN *).
Be certain to supply the proper cron time expression when deploying the CloudFormation stack to keep away from any failures.
- Hold all choices as default below Configure Stack choices and select Subsequent.
- Overview the settings, choose the acknowledge verify field, and create the stack.
If the CloudFormation stack fails for any motive, confer with Troubleshooting CloudFormation.
After the CloudFormation template is deployed, it’s going to create the next assets:
Workflow particulars
Let’s take a more in-depth have a look at the Lambda perform and the entire workflow.
The enter values supplied for SnsTopicArn, ClusterIdentifier, and S3Bucket within the CloudFormation stack creation are set as environmental variables within the Lambda perform. If the ClusterIdentifier parameter is None, then it’s going to invoke the ListRecommendations API to generate Advisor suggestions for all of the clusters throughout the account (identical AWS Area). In any other case, it’s going to move the ClusterIdentifier worth and generate Advisor suggestions just for the given cluster. If the enter parameter S3Bucket is supplied, the answer creates a folder named RedshiftAdvisorRecommendations and generates the Advisor suggestions file in JSON format inside it. If a price for S3Bucket isn’t supplied, this step shall be skipped.
Subsequent, the perform will summarize suggestions by every provisioned cluster (for all clusters within the account or a single cluster, relying in your settings) primarily based on the affect on efficiency and price as HIGH, MEDIUM, and LOW classes. An SNS notification e-mail shall be despatched to the subscribers with the summarized suggestions.
SQL instructions are included as a part of the Advisor’s beneficial motion. RecommendedActionType-SQL summarizes the variety of SQL actions that may be utilized utilizing SQL instructions.
If there are not any suggestions obtainable for any cluster, the SNS notification e-mail shall be despatched notifying there are not any Advisor suggestions.
An EventBridge rule is created to invoke the Lambda perform primarily based on the frequency you supplied within the stack parameters. By default, it’s scheduled to run weekly every Sunday at 14:00 UTC.
The next is a screenshot of a pattern SNS notification e-mail.
Clear up
We suggest deleting the CloudFormation stack when you aren’t going to proceed utilizing the answer. This may keep away from incurring any further prices from the assets created as a part of the answer.
Conclusion
On this publish, we mentioned how Redshift Advisor affords you particular suggestions to enhance the efficiency of and reduce the working prices to your Redshift cluster. We additionally confirmed you the best way to programmatically entry these suggestions by an API and implement them on-demand or mechanically utilizing your personal inside instruments with out getting access to the Amazon Redshift console.
By integrating these suggestions into your workflows, you may make knowledgeable choices and implement finest practices to optimize the efficiency and prices of your Redshift clusters, finally enhancing the general effectivity and productiveness of your information processing operations.
We encourage you to check out this automated resolution to entry Advisor suggestions programmatically. In case you have any suggestions or questions, please go away them within the feedback.
Concerning the authors
Ranjan Burman is an Analytics Specialist Options Architect at AWS. He focuses on Amazon Redshift and helps prospects construct scalable analytical options. He has greater than 16 years of expertise in numerous database and information warehousing applied sciences. He’s obsessed with automating and fixing buyer issues with cloud options.
Nita Shah is a Senior Analytics Specialist Options Architect at AWS primarily based out of New York. She has been constructing information warehouse options for over 20 years and focuses on Amazon Redshift. She is concentrated on serving to prospects design and construct enterprise-scale well-architected analytics and determination assist platforms.
Vamsi Bhadriraju is a Knowledge Architect at AWS. He works carefully with enterprise prospects to construct information lakes and analytical purposes on the AWS Cloud.
Sumant Nemmani is a Senior Technical Product Supervisor at AWS. He’s centered on serving to prospects of Amazon Redshift profit from options that use machine studying and clever mechanisms to allow the service to self-tune and optimize itself, guaranteeing Redshift stays price-performant as they scale their utilization.
