Skip to content

SSZcreate/Pentab_server / .agents/skills/cybersecurity/skills/implementing-aws-macie-for-data-classification

implementing-aws-macie-for-data-classification

Verified

Enable and configure Amazon Macie via AWS CLI/Terraform to discover, classify, and protect sensitive data (PII, financial data, credentials) in S3 using ML and pattern matching, including discovery jobs, custom data identifiers, allow lists, and EventBridge-based remediation. Use when setting up S3 data classification, cloud DLP, or auditing S3 for unprotected sensitive data.

FileKindSize
LICENSEother11.0 KB
SKILL.mdskill md8.3 KB
assets/template.mdmarkdown775 B
references/api-reference.mdmarkdown2.0 KB
references/standards.mdmarkdown625 B
references/workflows.mdmarkdown823 B
scripts/agent.pyscript6.0 KB
scripts/process.pyscript5.5 KB

references/api-reference.md

View on GitHub
# API Reference: AWS Macie Data Classification Agent

## Dependencies

| Library | Version | Purpose |
|---------|---------|---------|
| boto3 | >=1.28 | AWS SDK for Macie2 sensitive data discovery |

## CLI Usage

```bash
python scripts/agent.py \
  --profile security-audit \
  --region us-east-1 \
  --output-dir /reports/ \
  --output macie_report.json
```

## Functions

### `get_macie_client(profile, region)`
Creates boto3 Macie2 client with optional named profile.

### `enable_macie(client) -> dict`
Calls `client.get_macie_session()` to check status, then `client.enable_macie()` if needed.

### `list_s3_buckets_summary(client) -> list`
Calls `client.describe_buckets()` to get bucket inventory with encryption, public access, and classifiable object counts.

### `create_classification_job(client, bucket_names, job_name) -> dict`
Calls `client.create_classification_job(jobType="ONE_TIME", s3JobDefinition={...})` for targeted sensitive data discovery.

### `get_finding_statistics(client) -> dict`
Calls `client.get_finding_statistics(groupBy=...)` for severity and type breakdowns.

### `list_findings(client, severity, max_results) -> list`
Calls `client.list_findings()` with severity criterion, then `client.get_findings(findingIds=[...])` for details.

### `generate_report(client) -> dict`
Orchestrates all functions and compiles summary with public bucket identification.

## boto3 Macie2 Methods Used

| Method | Purpose |
|--------|---------|
| `enable_macie(status)` | Enable Macie service |
| `describe_buckets(criteria)` | S3 bucket inventory |
| `create_classification_job(...)` | Start discovery job |
| `get_finding_statistics(groupBy)` | Finding aggregations |
| `list_findings(findingCriteria)` | Filter findings |
| `get_findings(findingIds)` | Detailed finding data |

## Output Schema

```json
{
  "summary": {"total_buckets": 45, "public_buckets": 2, "high_findings": 12},
  "bucket_inventory": [{"name": "my-bucket", "public_access": "NOT_PUBLIC"}],
  "high_findings": [{"type": "SensitiveData:S3Object/Personal", "bucket": "data-lake"}]
}
```
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 192kUpdated Claude CodeCodexVerifiedInstall