AWSSupport-TroubleshootOpenSearchRedYellowCluster
Description
AWSSupport-TroubleshootOpenSearchRedYellowCluster
automation runbook is used to
identify the cause for red or yellow cluster health status and guide you through changing the cluster back to
green.
How does it work?
The runbook AWSSupport-TroubleshootOpenSearchRedYellowCluster
helps you
troubleshoot the cause of red or yellow cluster and provides the next steps to resolve this
issue by analyzing the cluster configuration and resource utilization.
The runbook performs the following steps:
-
Calls the DescribeDomain API against the target domain to get the cluster configuration.
-
Checks if the OpenSearch Service domain is internet-based (public) or Amazon Virtual Private Cloud (VPC)-based.
-
Creates a public or Amazon VPC-based Amazon Lambda function depending on the cluster configuration. Note: The Lambda function contains the troubleshooting code that run the OpenSearch Service APIs against the cluster to determine why the cluster is in red or yellow state.
-
Deletes the Lambda function.
-
Displays the checks performed and the next recommended steps to resolve the red or yellow cluster issue.
Document type
Automation
Owner
Amazon
Platforms
Linux, macOS, Windows
Parameters
Required IAM permissions
The AutomationAssumeRole
parameter requires the following actions to
use the runbook successfully.
-
cloudformation:CreateStack
-
cloudformation:DescribeStacks
-
cloudformation:DescribeStackEvents
-
cloudformation:DeleteStack
-
lambda:CreateFunction
-
lambda:DeleteFunction
-
lambda:InvokeFunction
-
lambda:GetFunction
-
es:DescribeDomain
-
es:DescribeDomainConfig
-
ec2:DescribeSecurityGroups
-
ec2:DescribeSubnets
-
ec2:DescribeVpcs
-
ec2:DescribeNetworkInterfaces
-
ec2:CreateNetworkInterface
-
ec2:DeleteNetworkInterface
-
ec2:DescribeInstances
-
ec2:AttachNetworkInterface
-
cloudwatch:GetMetricData
-
iam:PassRole
The LambdaExecutionRole
parameter requires the following actions to
successfully use the runbook:
-
es:ESHttpGet
-
ec2:CreateNetworkInterface
-
ec2:DescribeNetworkInterfaces
-
ec2:DeleteNetworkInterface
Overview of LambdaExecutionRole
policy:
The following is an example of a Lambda function's execution role (Amazon Identity and Access Management (IAM) role) that grants the function permission to access Amazon services and resources required by this runbook. For more information, see Lambda execution role.
Note
The ec2:DescribeNetworkInterfaces
,
ec2:CreateNetworkInterface
, and ec2:DeleteNetworkInterface
are only required if your OpenSearch Service cluster is Amazon VPC-based to
allow the Lambda function to create and manage the Amazon VPC network interfaces. For more
information, see Connecting outbound
networking to resources in a Amazon VPC and Lambda execution
role.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "es:ESHttpGet", "Resource": [ "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/", "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/_cluster/health", "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/_cat/indices", "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/_cat/allocation", "arn:<partition>:es:<region>:<account-id>:domain/<domain-name>/_cluster/allocation/explain" ] }, { "Condition": { "ArnLikeIfExists": { "ec2:Vpc": "arn:<partition>:ec2:<region>:<account-id>:vpc/<vpc_id>" } }, "Action": [ "ec2:DeleteNetworkInterface", "ec2:CreateNetworkInterface", "ec2:DescribeNetworkInterfaces", "ec2:UnassignPrivateIpAddresses", "ec2:AssignPrivateIpAddresses" ], "Resource": "*", "Effect": "Allow" } ] }
Instructions
Follow these steps to configure the automation:
-
Navigate to the AWSSupport-TroubleshootOpenSearchRedYellowCluster
in the Amazon Systems Manager console. -
Select Execute automation.
-
For the input parameters enter the following:
-
AutomationAssumeRole (Optional):
The Amazon Resource Name (ARN) of the Amazon Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation uses the permissions of the user that starts this runbook.
-
LambdaExecutionRole (Required):
The ARN of the IAM role that Lambda will use to sign requests to your Amazon OpenSearch Service cluster.
-
DomainName (Required):
The name of the OpenSearch Service domain with red or yellow cluster health status.
-
UtilizationThreshold (Optional):
The utilization threshold percentage used to compare the CPUUtilization and JVMMemoryPressure metrics. Default value is 80.
-
-
If you have enabled fine-grained access control on an OpenSearch Service cluster, make sure that the
LambdaExecutionRole
role arn is mapped to a role with at leastcluster_monitor
permission. -
Select Execute.
-
The automation initiates.
-
The automation runbook performs the following steps:
-
GetClusterConfiguration:
Fetches the OpenSearch Service cluster configuration.
-
CreateAWSLambdaFunctionStack:
Creates a temporary Lambda function in your account using Amazon CloudFormation. The Lambda function is used to run the OpenSearch Service APIs.
-
WaitForAWSLambdaFunctionStack:
Waits for the CloudFormation stack to complete.
-
GetClusterMetricsFromCloudWatch:
Gets the Amazon CloudWatch ClusterStatus, CPUUtilization, and JVMMemoryPressure OpenSearch Service cluster related metrics and its creation date.
-
RunOpenSearchAPIs:
Uses the Lambda function to call the OpenSearch Service APIs and analyze the cluster metrics data to diagnose the cause for the red or yellow cluster status.
-
DeleteAWSLambdaFunctionStack:
Deletes the Lambda function created by this automation in your account.
-
-
After completed, review the Outputs section for the detailed results of the execution.
-
RootCause:
Provides an overview of the identified cause for cluster health to be in red or yellow state.
-
IssueDescription:
Provides details for why the cluster is in red or yellow state and possible steps to return the cluster to green state.
-
References
Systems Manager Automation
Amazon service documentation
-
Refer toTroubleshooting Amazon OpenSearch Service for more information