|
| 1 | +## [Clens AWS Audit Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/.github/workflows/clens.yml) |
| 2 | + |
| 3 | +`clens` is a lightweight Go CLI — *see your cloud clearly* — that runs AWS audit tools via the clens API and extracts results locally into `_report/` and `_logs/`. |
| 4 | + |
| 5 | +### Usage |
| 6 | + |
| 7 | +This workflow builds `clens` from source, runs the selected audit tool using your AWS credentials, and uploads the report as a GitHub Actions artifact. Optionally sends a Slack notification on completion. |
| 8 | + |
| 9 | +### Available tools |
| 10 | + |
| 11 | +| Tool | Description | |
| 12 | +|---|---| |
| 13 | +| `aws-inventory` | EC2, RDS, Lambda, and S3 inventory | |
| 14 | +| `iam-audit` | IAM users, roles, and policy review | |
| 15 | +| `cost-report` | Cost breakdown via Cost Explorer | |
| 16 | +| `security-audit` | Security group, public access, and encryption checks | |
| 17 | +| `unused-resources` | Identify unused EC2, EBS, and EIP resources | |
| 18 | +| `tag-compliance` | Tag coverage and policy compliance | |
| 19 | +| `service-quotas` | Current service quota utilisation | |
| 20 | +| `all` | Run all tools in one request | |
| 21 | + |
| 22 | +### Example |
| 23 | + |
| 24 | +```yaml |
| 25 | +name: AWS Audit |
| 26 | + |
| 27 | +on: |
| 28 | + workflow_dispatch: |
| 29 | + schedule: |
| 30 | + - cron: '0 8 * * 1' # Every Monday at 08:00 UTC |
| 31 | + |
| 32 | +jobs: |
| 33 | + audit: |
| 34 | + name: Run clens audit |
| 35 | + uses: clouddrove/github-shared-workflows/.github/workflows/clens.yml@master |
| 36 | + with: |
| 37 | + tool: aws-inventory # Required: tool name or 'all' |
| 38 | + api_host: 192.168.13.245 # Optional: clens API host (IP or hostname) |
| 39 | + retention_days: 7 # Optional: artifact retention (default: 7) |
| 40 | + enable_slack_notification: false |
| 41 | + secrets: |
| 42 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 43 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 44 | + AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} # Optional |
| 45 | + API_TOKEN: ${{ secrets.API_TOKEN }} # Optional |
| 46 | +``` |
| 47 | +
|
| 48 | +### Run all tools with Slack notification |
| 49 | +
|
| 50 | +```yaml |
| 51 | +jobs: |
| 52 | + full-audit: |
| 53 | + name: Full AWS audit |
| 54 | + uses: clouddrove/github-shared-workflows/.github/workflows/clens.yml@master |
| 55 | + with: |
| 56 | + tool: all |
| 57 | + api_host: 192.168.13.245 |
| 58 | + retention_days: 14 |
| 59 | + enable_slack_notification: true |
| 60 | + slack_message: 'Weekly AWS audit complete' |
| 61 | + slack_env: production |
| 62 | + secrets: |
| 63 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 64 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 65 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
| 66 | + SLACK_USERNAME: ${{ secrets.SLACK_USERNAME }} |
| 67 | +``` |
| 68 | +
|
| 69 | +### Inputs |
| 70 | +
|
| 71 | +| Input | Required | Default | Description | |
| 72 | +|---|---|---|---| |
| 73 | +| `tool` | ✅ | — | Tool to run (see table above). | |
| 74 | +| `api_host` | ❌ | `''` | Clens API host (IP or hostname, with optional port). | |
| 75 | +| `api_run_path` | ❌ | `/aws/run` | API run path override. | |
| 76 | +| `retention_days` | ❌ | `7` | Artifact retention period in days. | |
| 77 | +| `enable_slack_notification` | ❌ | `false` | Send a Slack notification on completion. | |
| 78 | +| `slack_message` | ❌ | `Clens AWS audit complete` | Slack message body. | |
| 79 | +| `slack_env` | ❌ | `''` | Environment label in the Slack notification. | |
| 80 | + |
| 81 | +### Secrets |
| 82 | + |
| 83 | +| Secret | Required | Description | |
| 84 | +|---|---|---| |
| 85 | +| `AWS_ACCESS_KEY_ID` | ✅ | AWS access key ID. | |
| 86 | +| `AWS_SECRET_ACCESS_KEY` | ✅ | AWS secret access key. | |
| 87 | +| `AWS_SESSION_TOKEN` | ❌ | AWS session token (for temporary credentials). | |
| 88 | +| `API_TOKEN` | ❌ | API auth token sent as `X-API-Key`. | |
| 89 | +| `SLACK_WEBHOOK` | ❌ | Slack webhook URL. | |
| 90 | +| `SLACK_USERNAME` | ❌ | Slack username for the notification. | |
| 91 | + |
| 92 | +It uses Clouddrove Github-Shared-Workflow. [HERE](https://github.com/clouddrove/github-shared-workflows/blob/master/.github/workflows/clens.yml) |
0 commit comments