React to an SQS trigger
Trigger a Kestra flow automatically whenever a new message lands in an Amazon SQS queue.
Automate AWS FinOps cost reduction with Kestra. Query CloudWatch CPU utilization, detect idle EC2 instances, sync GitHub audit issues, and alert Slack.
Idle cloud compute instances left running over weekends and off-peak hours generate significant unmonitored cloud waste. This blueprint provides an automated FinOps guardrail that queries Amazon CloudWatch for 24-hour average CPU utilization, identifies underutilized EC2 instances, generates an auditable tracking issue on GitHub, and alerts engineering teams via Slack.
Schedule trigger (io.kestra.plugin.core.trigger.Schedule) fires daily (e.g. at 18:00 UTC) at the end of business hours.evaluate_cpu_utilization task (io.kestra.plugin.scripts.python.Script) connects to Amazon CloudWatch via boto3, pulls the 24-hour average CPU utilization metric for the specified instance, and evaluates if it falls below the idle threshold.create_finops_audit_issue task (io.kestra.plugin.github.issues.Create) automatically creates a GitHub tracking issue recording the performance audit and right-sizing recommendations.check_idle_state task (io.kestra.plugin.core.flow.If) evaluates the condition: if the instance is marked is_idle: true, it posts an alert to the FinOps Slack channel with the direct GitHub issue link. If healthy, it logs a compliant audit entry.Combining metric ingestion from AWS, mathematical thresholding in containerized Python, GitHub issue ticketing, and team notifications requires unifying separate vendor APIs into a reliable pipeline. Kestra manages secrets securely, logs detailed audit trails, handles transient cloud API retries, and executes scheduled checks reliably without external glue scripts.
cloudwatch:GetMetricData and cloudwatch:ListMetrics permissions.repo issues scope.AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: AWS credentials used by the CloudWatch metric analyzer.GITHUB_TOKEN: GitHub OAuth/Personal Access Token for logging audit issues.SLACK_WEBHOOK: Incoming Webhook URL for FinOps notifications.company.cloud).instance_id and region to target a development or staging EC2 instance.io.kestra.plugin.aws.ec2.Stop task to power down non-production instances automatically after approval.Environment=staging).