A Lambda for forwarding CloudWatch Alarms to EKS Events.
flowchart LR
CloudWatch --> Lambda
Lambda --> EKS
EKS --> Kubectl
{
"Statement": [
{
"Action": "cloudwatch:ListTagsForResource",
"Effect": "Allow",
"Resource": "*"
},
{
"Action": "eks:DescribeCluster",
"Effect": "Allow",
"Resource": "arn:aws:eks:REGION:ACCOUNT_ID:cluster/CLUSTER_NAME"
}
],
"Version": "2012-10-17"
}apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: NAME
rules:
- apiGroups:
- ""
resources:
- events
verbs:
- createskpr.io/k8s-event-api-versionskpr.io/k8s-event-kindskpr.io/k8s-event-clusterskpr.io/k8s-event-namespaceskpr.io/k8s-event-name
{
"alarmArn": "arn:aws:cloudwatch:ap-southeast-2:ACCOUNT_ID:alarm:CLOUDWATCH_ALARM_NAME",
"alarmData": {
"alarmName": "CLOUDWATCH_ALARM_NAME",
"state": {
"reason": "FAILING"
},
"configuration": {
"description": "This is a test"
}
}
}