Scanning With AWS Security Agent
AWSOfficialPublished by AWS
- Skill
- Workflow
- Cloud and DevOps
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides an end-to-end workflow for performing security scans on local codebases using the AWS Security Agent service. It manages the entire lifecycle of a scan, including workspace zipping, secure S3 uploads, job initiation, status polling, and the retrieval and reporting of findings. The skill handles configuration state locally, ensuring that scans are repeatable and that findings are documented with clear remediation guidance.
What it does
- Performs full repository security scans using the AWS Security Agent.
- Automates the zipping and uploading of workspace source code to AWS S3.
- Polls scan status asynchronously and notifies the user upon completion.
- Generates formatted, severity-ranked reports with file locations and remediation steps.
- Maintains a local history of scans and configuration settings for workspace persistence.
- Provides options to stop active scans or list historical scan results.
When to use it
- When you need to perform a comprehensive security audit of your current workspace.
- When you want to identify vulnerabilities in your code with ranked severity levels.
- When you need to check the progress or status of a previously initiated security scan.
- When you need to review detailed findings and remediation advice for a completed scan.
Advantages
- Integrates directly with AWS managed security services for reliable analysis.
- Provides clear, actionable remediation guidance for identified security issues.
- Reduces manual effort by automating the upload, scan, and reporting pipeline.
- Maintains local state to allow for quick status checks and historical tracking.
Usage examples
- “Scan my code for vulnerabilities.”
- The agent will verify the workspace configuration, zip the source code, initiate an AWS Security Agent scan, and begin polling for results.
- “What is the status of my security scan?”
- The agent will check the current status of the most recent scan job and report whether it is still in progress, completed, or failed.
- “Show me the findings from the last scan.”
- The agent will fetch the scan results, group them by severity, display a summary in the chat, and save a detailed report to the local workspace.
- “Stop the current security scan.”
- The agent will issue a command to terminate the active code review job and update the local scan history status to stopped.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/aws/scanning-with-aws-security-agent/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip scanning-with-aws-security-agent.zip -d .agents/skills
Documentation by AWS
AWS Security Agent — Code Scans
This skill handles full repository scans. Setup (agent space, role, bucket) is handled by the setup-security-agent skill — if .security-agent/config.json is missing, the scan workflow auto-runs setup inline first.
Action mapping
| User intent | Workflow |
|---|---|
| Direct scan request ("scan my code", "find vulnerabilities") | Full Scan |
| Scan status check ("how's the scan", "progress") | Status workflow |
| View findings ("what did it find", "show results") | Findings workflow |
| List scans ("recent scans", "show my scans") | Read .security-agent/scans.json |
| Stop a scan | aws securityagent stop-code-review-job |
Rules for proactive suggestions
Always ask before running — never auto-trigger scans
Single-line suggestions, not multi-paragraph pitches
If the user declines, do not bring it up again in the same session
Local state
Read .security-agent/config.json for agent_space_id and region. If config.json is missing, tell the user one line — "First scan in this workspace — running setup first." — and run the setup-security-agent workflow inline (steps from that skill's SKILL.md) before continuing. First-time scans should "just work."
Track scans in .security-agent/scans.json (keep last 50 entries). The per-workspace CodeReview ID is stored in config.json → code_reviews[<abs_path>] so subsequent scans reuse the same CodeReview.
Resolving the values you need
The CLI examples below use placeholders. Resolve them at the start of every scan:
| Placeholder | How to resolve |
|---|---|
<id> (agent space) | config.agent_space_id |
<region> | config.region (default us-east-1) |
<account> | aws sts get-caller-identity --query Account --output text (cache for the rest of the turn) |
<role-arn> | arn:aws:iam::<account>:role/SecurityAgentScanRole |
<bucket> | security-agent-scans-<account>-<region> |
<cr-id> | code_review_id from config.json → code_reviews[<abs_path>] |
<job_id> | codeReviewJobId returned by start-code-review-job |
<WORKSPACE_ID> | printf '%s' "$(pwd)" | md5sum | cut -c1-12 |
These are derived rather than stored in config so they can never drift out of sync with reality.
Pre-scan checks
Read
config.json. If missing → run thesetup-security-agentworkflow inline first, then continue.Verify agent space still exists:
aws securityagent batch-get-agent-spaces --agent-space-ids <id>If response shows it doesn't exist, clear
agent_space_idfromconfig.jsonand runsetup-security-agentagain.Resolve account, role ARN, and bucket name from the table above.
Generate workspace ID:
WORKSPACE_ID=$(printf '%s' "$(pwd)" | md5sum | cut -c1-12)
Workflow: Full Scan (~45 min)
For scanning only changed code, use the diff-scanning-with-aws-security-agent skill instead. For threat modeling specs, use threat-modeling-with-aws-security-agent.
Run pre-scan checks above.
Zip the workspace. Exclude common build/cache directories. Honor
.gitignore. Bail if zip > 2 GB.cd <absolute-workspace-path> zip -r /tmp/source.zip . \ -x ".git/*" \ -x ".security-agent/*" \ -x "node_modules/*" \ -x "__pycache__/*" \ -x ".venv/*" -x "venv/*" \ -x "dist/*" -x "build/*" -x "target/*" \ -x ".mypy_cache/*" -x ".pytest_cache/*" -x ".tox/*" \ -x ".next/*" -x "cdk.out/*" \ -x ".DS_Store" -x "Thumbs.db" \ -x "*.pyc" -x "*.pyo" ZIP_BYTES=$(stat -f%z /tmp/source.zip 2>/dev/null || stat -c%s /tmp/source.zip) if [ "$ZIP_BYTES" -gt 2147483648 ]; then echo "Zip too large (>2GB)"; exit 1; fiUpload to the per-workspace stable key (overwrites any prior upload):
aws s3 cp /tmp/source.zip s3://<bucket>/security-scans/source/<WORKSPACE_ID>/source.zip --expected-bucket-owner <account>Get or create the per-workspace CodeReview. Look up
config.json → code_reviews[<abs_path>].If present, use that
code_review_id.If absent, create:
aws securityagent create-code-review --agent-space-id <id> --title <title> \ --service-role <role-arn> \ --assets sourceCode=[{s3Location=s3://<bucket>/security-scans/source/<WORKSPACE_ID>/source.zip}]Capture
codeReviewIdand persist toconfig.json → code_reviews[<abs_path>].Title default:
pre-cr-<git-branch>(usegit rev-parse --abbrev-ref HEAD). Replace any spaces with hyphens.
Start the job:
aws securityagent start-code-review-job --agent-space-id <id> --code-review-id <cr-id>If the response is
ResourceNotFoundException: the CodeReview was deleted externally. Recreate it (step 4) and retry.
Capture
codeReviewJobId. Generate a localscan_idlikescan-<8-hex>. Append toscans.json:{ "scan_id": "scan-...", "code_review_id": "cr-...", "job_id": "cj-...", "agent_space_id": "as-...", "scan_type": "FULL", "title": "pre-cr-main", "path": "/abs/path", "started_at": "2026-06-01T20:00:00Z", "status": "IN_PROGRESS" }Tell user: "Full scan started (scan_id: {id}). Takes ~45 minutes. I'll check every 5 minutes — say 'stop polling' to opt out."
Run the Polling Loop below with
sleep 300between checks.
Polling Loop
After starting a scan:
sleep 300(5 minutes). Do not poll faster than this.Call status:
aws securityagent batch-get-code-review-jobs --agent-space-id <id> --code-review-job-ids <job_id>Compare
statusto last seen status. Only respond to the user when status CHANGES (e.g.,IN_PROGRESS→COMPLETED) or on terminal state (COMPLETED,FAILED,STOPPED).Do not report "still in progress" multiple times — that's noise.
If user says "stop polling" or "check later" → stop the loop and tell them: "Say 'scan status' or 'show findings' anytime."
On
COMPLETED→ run the Findings workflow.On
FAILED→ fetch the job's error info (statusReasonif present), tell the user, write a brief failure note to.security-agent/findings-{scan_id}.md.
Workflow: Status check (ad-hoc)
User says "scan status" / "how's the scan":
If user names a
scan_id, use it. Otherwise use the most recent entry inscans.json.Call
batch-get-code-review-jobsonce.Update
scans.jsonstatus field.Report: status + elapsed time + current step (if any).
Workflow: Findings
After a scan completes (or on user request):
1. Fetch findings (paginate)
aws securityagent list-findings --agent-space-id <id> --code-review-job-id <job-id>If nextToken is returned, call again with --next-token <token> until exhausted.
2. Enrich with full details
aws securityagent batch-get-findings --agent-space-id <id> --finding-ids <id1> <id2> ...3. Filter (optional)
If the user asked for a minimum severity (e.g., "high and above"), filter to that level:
Severity order: CRITICAL > HIGH > MEDIUM > LOW > INFORMATIONAL.
4. Concise summary in chat
Group by severity. File path + line for each:
🟣 CRITICAL: {name}
File: {filePath}:{lineStart}
{description}
🔴 HIGH: {name}
File: {filePath}:{lineStart}
{description}
🟡 MEDIUM: {name}
File: {filePath}:{lineStart}
{description}
🟢 LOW: {name}
File: {filePath}:{lineStart}
{description}5. Detailed report file
Write to .security-agent/findings-{scan_id}.md. Include EVERY field returned (findingId, name, description, riskLevel, riskType, confidence, status, codeLocations with filePath/lineStart/lineEnd, and remediationCode if present).
# Security Scan Report — {scan_id}
**Scan type**: FULL
**Title**: {title}
**Started**: {started_at}
**Total findings**: {count}
## Summary
| Severity | Count |
|----------|-------|
| CRITICAL | N |
| HIGH | N |
| MEDIUM | N |
| LOW | N |
## Findings
### 🟣 CRITICAL: {name}
- **ID**: {findingId}
- **Risk type**: {riskType}
- **Confidence**: {confidence}
- **Status**: {status}
- **Location**: `{filePath}:{lineStart}-{lineEnd}`
**Description**: {description}
**Remediation**:
{remediationCode or remediation guidance from description}
(repeat for every finding)Tell user: "Full details written to .security-agent/findings-{scan_id}.md"
6. Follow-ups
Ask:
"Would you like to focus on the critical/high findings first?"
"Should I explain any of these in more detail?"
"Want me to fix these issues?"
For fixes: read the finding's description and code location, then synthesize and apply the fix via the Edit tool.
Workflow: Stop a scan
User says "stop the scan":
aws securityagent stop-code-review-job --agent-space-id <id> --code-review-job-id <job_id>Update scans.json status to STOPPED.
Workflow: List recent scans
User asks "show my recent scans" / "list scans":
Read .security-agent/scans.json. Show in a compact table:
| scan_id | type | title | status | started |
|---|---|---|---|---|
| scan-abc | FULL | pre-cr-main | COMPLETED | 2h ago |
| scan-def | FULL | pre-cr-feature-x | FAILED | 1d ago |
Rules
Always run pre-scan checks (config exists + agent space verified) before any scan
Scan APIs return immediately — poll status every 5 minutes
Use the most recent scan in
scans.jsonif the user doesn't name oneTitle must not contain spaces — use hyphens. Default to git branch name.
Don't dump raw JSON — format with severity icons + file locations
On
ResourceNotFoundExceptionfromstart-code-review-job, recreate the CodeReview and retry once
Troubleshooting
"Not configured" /
config.jsonmissing → runsetup-security-agentskill firstAccessDeniedons3 cp→ bucket not registered on agent space, or trust policy wrong. Re-run setup.403/ExpectedBucketOwnermismatch ons3 cp→ the derived bucket is owned by a different account (bucket-squatting). The upload is rejected by design — do not retry without the guard. Re-runsetup-security-agent, which aborts on foreign-owned buckets.ResourceNotFoundExceptionon agent space → it was deleted. Re-run setup.Scan stuck in PREFLIGHT for >10 min → backend issue, not client. Show
batch-get-code-review-jobsoutput and tell user to escalate.Code too large (zip > 2 GB) → run on a subdirectory instead.
Files
- ATTRIBUTION.mdAdded by AutoGineer950 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md10.9 KiB
ATTRIBUTION.md
Attribution
This folder is an unmodified copy of the Agent Skill "scanning-with-aws-security-agent", distributed by AutoGineer (https://autogineer.com/agent-skills).
Commit: 0a218f8cc13220013f72147e2e0fdbe350b34ae2
Published by: AWS (https://github.com/aws)
Publisher: AWS (https://github.com/aws)
Licence: Apache License 2.0 (https://github.com/aws/agent-toolkit-for-aws/blob/0a218f8cc13220013f72147e2e0fdbe350b34ae2/LICENSE)
Licence evidence: repository licence LICENSE
Retrieved: 2026-11-07
The skill's own files are unmodified copies. AutoGineer is not affiliated with or endorsed by the author or the publisher.
Files added by AutoGineer
ATTRIBUTION.md: this file, written by AutoGineer
LICENSE: copied from LICENSE
NOTICE: copied from NOTICE
Requirements and compatibility
Written for: Claude Code
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Names Claude Code tools, Needs a command-line tool
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- AWS
- Publisher
- AWS (Official)
- Source
- aws/agent-toolkit-for-aws · plugins/aws-agents-for-devsecops/skills/scanning-with-aws-security-agent · commit 0a218f8
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by AWS or AWS.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download scanning-with-aws-security-agent.zip