AWS Security Agent is an AI agent that reviews designs and code, builds threat models and runs penetration tests against your applications, so it needs the same identity, scope and oversight controls as any other privileged non-human identity. This guide explains what the service does, the IAM roles and Agent Spaces it runs through, how target domains are verified, how testing credentials should be handled, and the governance practices that keep an autonomous testing agent inside its authorised scope.
It is written for application security leads, cloud platform teams and identity teams who are enabling the service or reviewing a request to enable it. For general AWS account hardening, see the AWS Security Guide; for AWS's AI coding assistants, see the Amazon Q Developer and Kiro Security Guide. This page covers the AWS Security Agent product only.
This is an independent guide from NHI Mgmt Group, based on AWS's public documentation as of November 2026. It is not sponsored or reviewed by AWS. Product features change, so confirm settings against AWS's current documentation.
Key takeaways
- AWS Security Agent (described by AWS as now part of AWS Continuum) covers design security review, code security review, penetration testing and threat modelling.
- It runs through three service roles in your account: an application role, an Agent Space service role and, when scheduling is on, a scheduler execution role. Each is a non-human identity to inventory and review.
- The Agent Space service role is shared by every capability in that space. Attach only the secrets, Lambda functions, S3 buckets, log groups and VPCs that space needs.
- Penetration tests run only against verified domains, proved by a DNS TXT record, an HTTP route token or, for private targets, private VPC verification.
- AWS strongly recommends testing only pre-production environments, and states the service is not a replacement for professional penetration testing.
- Give the agent dedicated, narrowly scoped test credentials stored in AWS Secrets Manager or vended by a Lambda function, never a real user's or an administrator's account.
What AWS Security Agent does
AWS describes the service as a frontier agent that secures applications throughout the development lifecycle. Its documented capabilities are:
- Design security review. Feedback on design documents, checked against your organisational security requirements before code is written.
- Code security review. Full code reviews of GitHub, GitLab, Bitbucket or GitHub Enterprise Server repositories, or S3 buckets, plus automated pull request analysis that posts findings as pull or merge request comments. It can also generate pull or merge requests with fixes.
- Penetration testing. Specialised AI agents run multi-step attack scenarios, using source code and documentation for context, and document findings with impact analysis and reproducible attack paths.
- Threat modelling. Generates a system overview and STRIDE-classified threats with severity levels and recommendations from scope documents, source code or both.
Security requirements, such as approved authorisation libraries, logging standards and data access policies, are defined once in the AWS console and applied across reviews. AWS's user guide also documents integrations with source control and work tracking systems (GitHub, GitLab, Azure DevOps, Bitbucket, Confluence and Jira), private source control and private VPC connections, scheduling and CI/CD-triggered penetration tests.
From an identity point of view, the important fact is that this is an agent acting with delegated access: it reads your code and documents, holds credentials for your test applications, sends attack traffic and can open pull requests. Every one of those capabilities is a permission someone granted to a machine.
The shared responsibility split
AWS's shared responsibility statement for the service says AWS secures the service infrastructure, the AI models and the penetration testing agents. You are responsible for:
- Managing access through IAM policies and permissions.
- Protecting the content you submit, such as design documents, code repositories and application URLs.
- Configuring which repositories and applications are monitored.
- Reviewing and acting on findings, and securing your applications based on the remediation guidance.
- Assessing your data sensitivity, company requirements and applicable laws and regulations.
In practice this means the decisions that determine risk, which repositories it can read, which domains it can attack, which credentials it holds and who can start a test, all sit with the customer.
Agent Spaces and the three service roles
Agent Spaces are the unit of configuration. AWS documents three service roles, all created by the console with permissions generated from the resources you select.
| Role | How many | Trusted principal | What it does |
|---|---|---|---|
| Application role | One per application | securityagent.amazonaws.com | Lets web application users call AWS Security Agent APIs, including through IAM Identity Center sign-in. Uses the AWS managed policy AWSSecurityAgentWebAppPolicy. |
| Agent Space service role | One per Agent Space | securityagent.amazonaws.com | Used by penetration testing, code review and threat modelling in that space to reach attached resources. |
| Scheduler execution role | One per Agent Space, only when scheduling is enabled | scheduler.amazonaws.com | Starts scheduled jobs in that Agent Space. Named continuum-schedule-<agentSpaceId> under /service-role/; do not rename it. |
Trust policy conditions
The documented trust policies use aws:SourceAccount and aws:SourceArn to prevent confused deputy use. The application role restricts sts:AssumeRole to application/* and agent-space/* in your account and also allows sts:SetContext restricted to the IAM Identity Center context provider; AWS notes that without sts:SetContext, Identity Center sign-in to the web app fails. The service role trust is limited to Agent Spaces in your account, and no external ID is used. The scheduler role is limited to the schedule group for that Agent Space. Check these conditions survive any infrastructure-as-code rewrite of the roles.
Agent Space service role policies
The service role's permissions are split into separate policies, and each policy exists only when you attach that resource type:
SecurityAgentBasePolicy: always present; reads its own role and Agent Space secrets and writes assessment logs, scoped to a/aws/securityagent/<agent-space>*log group prefix.VpcPolicy: when a VPC with subnets or security groups is attached; manages network interfaces. AWS notes its EC2 actions useResource: "*", withec2:CreateNetworkInterfacePermissionlimited to the selected subnet. Review this during audits.StaticCloudWatchPolicy,SecretsPolicy,LambdaPolicyandS3Policy: scoped to the specific log groups, secrets, functions and buckets you selected.
Because one service role is shared by every capability in a space, a secret attached for penetration testing is also reachable by the role while it runs code reviews and threat models. NHI Mgmt Group recommends separate Agent Spaces per application or per trust boundary, rather than one space for the organisation, so a role's reach matches a single team's assets. AWS documents quotas of up to 100 Agent Spaces per account, so this is practical.
Customer managed keys
If an Agent Space is encrypted with a customer managed KMS key, each policy for an encrypted resource grants KMS permissions scoped to that key, and the scheduler role gets only kms:GenerateDataKey and kms:Decrypt with kms:ViaService and an encryption context bound to the Agent Space ARN. Use a customer managed key where your data classification requires control over revocation.
Controlling who can run tests
Human users reach the service through the AWS Security Agent web application, signing in through IAM Identity Center or an admin access link. AWS states that the IAM Identity Center integration supports role-based access to create, manage and view design reviews and penetration tests.
Starting a penetration test is an authorisation decision with legal and operational weight, so treat it as a privileged action:
- Limit who can configure Agent Spaces, add target domains and attach credentials to a small administrator group.
- Separate the ability to start tests from the ability to change scope, so that one person cannot both widen the target list and launch against it.
- Review the scheduler role and every schedule periodically. A forgotten schedule is an agent that keeps attacking a system after its owner has moved on.
- Record who approved each target and why, alongside the domain verification evidence.
The scheduler role's documented permissions allow securityagent:StartPentestJob, StartCodeReviewJob, StartThreatModelJob and CreateDesignReview scoped to a single Agent Space ARN, which is a good model for any custom automation role you build around the service.
Target domain verification and scope
AWS Security Agent only runs penetration tests against verified domains. Domains are added in the Penetration test tab of the Agent Space and verified by one of three methods:
- DNS TXT record. The service generates a TXT value for your DNS provider. Route 53 in the same account supports one-click verification.
- HTTP route. A token in
.well-known/aws/securityagent-domain-verification.json, fetched by an HTTPS GET. Public domains need a valid TLS certificate first. - Private VPC. For private VPC testing only; checks that the domain resolves to a private CIDR address.
Two scope details deserve attention. First, DNS TXT and HTTP verification of example.com automatically covers sub-domains such as api.example.com. AWS suggests verifying a sub-domain where you can create TXT records; NHI Mgmt Group recommends verifying the narrowest sub-domain that covers the test environment, so a verified apex does not silently bring production hosts into scope. Second, private VPC verification requires an exact domain match and does not extend to sub-domains.
During a test, the network blocks requests to URLs other than the target and accessible URLs, and customers can select vulnerability categories per endpoint and list out-of-scope URLs. You must be authorised to test every system a test might affect, and use must follow the AWS Acceptable Use Policy. AWS monitors for requests outside the targets and, if it detects abuse such as testing a third-party endpoint, terminates all ongoing penetration tests in the account. Where verification cannot be completed, AWS allows a manual verification request through a support case with a business justification; keep that route exceptional and documented.
Testing credentials as non-human identities
To test authenticated functionality the agent needs to sign in. AWS documents two methods: a static username and password stored in AWS Secrets Manager, or a credential vendor implemented as an AWS Lambda function, with support for common methods including OAuth and JWT. The user guide also covers trusted CA certificates and client certificates for mutual TLS.
AWS recommends creating new credentials with appropriately scoped permissions for penetration testing only. Build on that with these practices:
- Create a dedicated test account per application and environment, clearly named as belonging to the agent, with an owner and an expiry date.
- Never reuse a real employee account, a shared administrator login or a production service credential.
- Prefer the Lambda credential vendor for short-lived tokens, so a captured credential expires quickly.
- Rotate or disable test credentials after each test cycle and when an Agent Space is retired.
- Note that AWS states credential tests are not subject to the URL allowlist restriction, so the agent can discover domains the application reaches while signed in. Scope the test identity so that what it can reach is what you intend to test.
Because the Agent Space's SecretsPolicy grants the service role read access to the attached secrets, treat the set of attached secrets as part of the role's permission boundary and review it like any other secret access grant.
Penetration test safety and pre-production use
AWS documents a set of guardrails: intentionally minimal-impact payloads (for example extracting a database version rather than dropping a table on finding SQL injection), deterministic guardrails against risky behaviour such as excessive load, velocity controls per endpoint and guardrails intended to prevent denial of service. Outbound callbacks for validating findings such as server-side request forgery go only to an AWS-operated collaborator endpoint, with a unique per-test identifier.
AWS is equally clear about residual risk. Unintended business logic interactions can still occur, targets should expect increased traffic and monitoring alerts, the agent's behaviour is stochastic so coverage is not guaranteed, and there is no preview of the plan before a run. AWS strongly recommends running tests only in pre-production. Operational guidance that follows:
- Point tests at staging environments with synthetic data and no live integrations that send email, payments or messages.
- Tell your SOC and any managed detection provider when tests run, and tag the traffic source, so alerts are triaged rather than escalated as incidents.
- Watch the penetration test logs, which show every endpoint discovered and action taken, and stop a run from the console if its trajectory is undesirable.
- Keep human validation: by default only high or medium confidence findings are reported, and AWS states the service is not a professional penetration testing service but on-demand testing alongside expert review.
For generative AI applications the documented test scope covers prompt injection, sensitive information disclosure, improper output handling, excessive agency and system prompt leakage, aligned with the OWASP Top 10 for LLM Applications. AWS's security considerations do not state whether the agent itself can be manipulated by content it meets on a target, so treat untrusted target content as a risk to confirm with AWS.
Code access, data handling and pull requests
Code review and threat modelling require read access to repositories, and remediation features can open pull requests. Treat the source control integration like any other third-party app installation: install it only on the repositories each Agent Space needs, review its granted scopes, and require normal branch protection and human approval on any agent-generated pull request. Automatically generated fixes are suggestions, not approved changes.
On data, AWS states uploaded artefacts (source code, threat models, design documents and API documentation as additional learning resources) are stored only in the region where the request originated, but that the service uses cross-region inference within your geography, so input prompts and outputs may be processed outside the originating region. Data is transmitted encrypted. Confirm this against your data residency obligations before attaching regulated code or documents.
Common failure patterns
- One Agent Space for everything. The shared service role ends up able to read every team's secrets and buckets.
- Apex domain verification. Verifying
example.combrings every sub-domain, including production, into scope. - Real accounts as test credentials. An administrator login handed to the agent gives it far more reach than the test needs.
- Production testing by default. Business logic side effects and alert storms in live systems.
- Orphaned schedules. Scheduled tests keep running after an application owner leaves.
- Auto-merging agent pull requests. Generated fixes merged without review.
- Treating results as a full penetration test. Stochastic coverage reported to auditors as complete assurance.
Practitioner checklist
- Add the application role, every Agent Space service role and every scheduler role to your NHI inventory with an owner.
- Confirm
aws:SourceAccountandaws:SourceArnconditions are present on all three trust policies. - Create one Agent Space per application or trust boundary and attach only the resources it needs.
- Restrict Agent Space administration and domain management to a small group through IAM Identity Center.
- Verify the narrowest sub-domain for each test environment and record authorisation evidence.
- Use dedicated, least-privilege test credentials in Secrets Manager or a Lambda credential vendor, and rotate them after each cycle.
- Test pre-production only, notify the SOC and monitor run logs.
- Require human review of findings and of every agent-generated pull request.
- Use a customer managed KMS key where data classification requires it, and check cross-region inference against residency rules.
- Review schedules and retire Agent Spaces, roles and secrets when applications are decommissioned.
Standards and references
- AWS: What is AWS Security Agent
- AWS: Create the IAM roles for AWS Security Agent
- AWS: AWS Security Agent security considerations
- AWS: Enable an application domain for penetration testing
- AWS: Security in AWS Security Agent
- OWASP GenAI Security Project: Top 10 for Agentic Applications for 2026
- NIST: SP 800-115 Technical Guide to Information Security Testing and Assessment
- NIST: SP 800-53 Rev. 5 (AC-6 Least Privilege)
Related NHI Mgmt Group resources: AWS Security Guide · Amazon Q Developer and Kiro Security Guide · AWS Security Checklist