opslens

Templates

Ready-made automations that work with no AI. Each is a small spec you can read, test, change and deploy. Open one in the app, or install it with opslens pack install <name>.

Unattached EBS volume cleanup

finops-cleanup/unattached-volumes · runs on a schedule (daily) · Open in the app

Finds EBS volumes unattached for N days, opens a Jira ticket for each, and deletes them after approval.

step action effect when
1. Open a ticket per volume jira.create_issue notify automatic
2. Delete the volume aws.delete_ebs_volume change after approval

Variables: jira_project, jira_issue_type.

opslens pack install finops-cleanup/unattached-volumes
name: unattached_volume_cleanup
title: Unattached EBS volume cleanup
description: Finds EBS volumes unattached for N days, opens a Jira ticket for each, and deletes them after approval.
request: ''
variables:
  jira_project:
    default: OPS
    description: Jira project key tickets are created in.
  jira_issue_type:
    default: Task
    description: Jira issue type for the tickets.
trigger:
  kind: schedule
  schedule: daily
detect:
  sql: |
    select
      volume_id,
      region,
      account_id,
      size,
      volume_type,
      create_time
    from aws_ebs_volume
    where state = 'available'
      and create_time < now() - interval '14 days'
  max_items: 50
notify: true
approval:
  prompt: Delete these unattached volumes?
actions:
- pipeline: jira.create_issue
  args:
    project_key: '{var.jira_project}'
    issue_type: '{var.jira_issue_type}'
    summary: Unattached EBS volume {volume_id} ({size} GiB {volume_type}) in {region}
    description: Volume {volume_id} in account {account_id} / {region} has been unattached since {create_time}.
  gated: false
  title: Open a ticket per volume
- pipeline: aws.delete_ebs_volume
  args:
    volume_id: '{volume_id}'
    region: '{region}'
  gated: true
  title: Delete the volume
auto_apply: false

EC2 owner-tag enforcement

governance/tag-enforcement · runs on a schedule (daily) · Open in the app

Finds running EC2 instances with no Owner tag, opens a Jira ticket for each, and flags them with a tag after approval.

step action effect when
1. Open a ticket per instance jira.create_issue notify automatic
2. Tag the instance aws.tag_resources change after approval

Variables: jira_project, jira_issue_type.

opslens pack install governance/tag-enforcement
name: ec2_tag_enforcement
title: EC2 owner-tag enforcement
description: Finds running EC2 instances with no Owner tag, opens a Jira ticket for each, and flags them with a
  tag after approval.
request: ''
variables:
  jira_project:
    default: OPS
    description: Jira project key tickets are created in.
  jira_issue_type:
    default: Task
    description: Jira issue type for the tickets.
trigger:
  kind: schedule
  schedule: daily
detect:
  sql: |
    select
      instance_id,
      arn,
      region,
      account_id,
      instance_type,
      launch_time
    from aws_ec2_instance
    where instance_state = 'running'
      and tags ->> 'Owner' is null
  max_items: 50
notify: true
approval:
  prompt: Flag these instances with the compliance tag?
actions:
- pipeline: jira.create_issue
  args:
    project_key: '{var.jira_project}'
    issue_type: '{var.jira_issue_type}'
    summary: EC2 instance {instance_id} ({instance_type}) in {region} has no Owner tag
    description: Instance {instance_id} in account {account_id} / {region}, launched {launch_time}, has no Owner
      tag. Please assign an owner.
  gated: false
  title: Open a ticket per instance
- pipeline: aws.tag_resources
  args:
    region: '{region}'
    resource_arns: '{arn}'
    tags: compliance=missing-owner
  gated: true
  title: Tag the instance
auto_apply: false

Incident copilot

incident/incident-copilot · runs on demand · Open in the app

Enriches each open Opsgenie alert with recent GitLab deploys and open high-priority Jira issues, and posts a summary to Teams.

step action effect when
1. Post an incident summary teams.send_channel_message notify automatic

Variables: teams_team_id, teams_channel_id.

opslens pack install incident/incident-copilot
name: incident_copilot
title: Incident copilot
description: Enriches each open Opsgenie alert with recent GitLab deploys and open high-priority Jira issues, and
  posts a summary to Teams.
request: ''
variables:
  teams_team_id:
    default: CHANGE-ME
    description: Microsoft Teams team id to post into.
  teams_channel_id:
    default: CHANGE-ME
    description: Microsoft Teams channel id to post into.
trigger:
  kind: manual
  schedule: daily
detect:
  sql: |
    select
      a.alert_id,
      a.message,
      a.priority,
      a.created_at,
      (select count(*) from gitlab_project_deployment d
        where d.project_id = '42' and d.status = 'success'
          and d.created_at <= a.created_at
          and d.created_at > a.created_at - interval '6 hours') as recent_deploys,
      coalesce((select d.ref from gitlab_project_deployment d
        where d.project_id = '42' and d.status = 'success' and d.created_at <= a.created_at
        order by d.created_at desc limit 1), 'none') as last_deploy_ref,
      (select count(*) from jira_issue j
        where j.project_key = 'OPS' and j.status <> 'Done'
          and j.priority in ('High', 'Highest')) as open_high_issues
    from opsgenie_alert a
    where a.status = 'open'
  max_items: 20
notify: false
approval:
  prompt: Approve the gated actions for these items?
actions:
- pipeline: teams.send_channel_message
  args:
    team_id: '{var.teams_team_id}'
    channel_id: '{var.teams_channel_id}'
    message: '[{priority}] {message} (alert {alert_id}). Deploys in the 6h before: {recent_deploys} (latest: {last_deploy_ref}).
      Open high-priority Jira issues: {open_high_issues}.'
  gated: false
  title: Post an incident summary
auto_apply: false

GuardDuty high-severity findings to Jira

security/guardduty-to-jira · runs on a schedule (hourly) · Open in the app

Files a Jira ticket for each new GuardDuty finding of severity 7 or higher, skipping findings that already have one.

step action effect when
1. Open a ticket per finding jira.create_issue notify automatic

Variables: none.

opslens pack install security/guardduty-to-jira
name: guardduty_findings_to_jira
title: GuardDuty high-severity findings to Jira
description: Files a Jira ticket for each new GuardDuty finding of severity 7 or higher, skipping findings that
  already have one.
request: ''
variables: {}
trigger:
  kind: schedule
  schedule: hourly
detect:
  sql: |
    select
      f.id,
      f.title,
      f.type,
      f.severity,
      f.region,
      f.account_id,
      f.created_at
    from aws_guardduty_finding f
    where f.severity >= 7
      and f.created_at > now() - interval '7 days'
      and not exists (
        select 1 from jira_issue j
        where j.project_key = 'OPS'
          and j.summary like '%' || f.id || '%'
      )
  max_items: 25
notify: true
approval:
  prompt: Approve the gated actions for these items?
actions:
- pipeline: jira.create_issue
  args:
    project_key: OPS
    issue_type: Task
    summary: '[GuardDuty {severity}] {title} ({id})'
    description: GuardDuty finding {id} of type {type}, severity {severity}, in account {account_id} / {region},
      first seen {created_at}.
  gated: false
  title: Open a ticket per finding
auto_apply: false