sample-aiml-security-assessment

Troubleshooting Guide

This guide covers common issues and debugging steps for the AI/ML Security Assessment framework. For upgrade procedures, see the Upgrade Guide. For general questions about cost, scheduling, and data handling, see the FAQ.

Table of Contents


Common Issues

1. AWS CloudFormation StackSet Deployment Failures

Symptoms: StackSet instances fail to create in member accounts.

Solutions:

2. Cross-Account Role Assumption or Access Denied Errors

Symptoms: “Access Denied” errors in the CodeBuild logs, often when assuming roles in member accounts.

Causes and solutions:

3. AWS SAM Deployment Failures

Symptoms: CodeBuild fails during the SAM deploy phase.

Solutions:

4. AWS Step Functions Execution Failures

Symptoms: A Step Functions execution shows a failed state or times out.

Solutions:

5. EarlyValidation::ResourceExistenceCheck Error

Symptoms: CloudFormation blocks stack creation with this error.

Cause: A resource with the same fixed name already exists outside the stack, typically left over from a failed or deleted deployment. The templates give fixed names to these resources:

Solution: Find the resource named in the error, confirm it is not used by another deployment, and delete it or delete the stack that still owns it. Then start the deployment or CodeBuild again.

S3 buckets are not given fixed names, so they do not cause this error. To remove leftover report buckets, see Emptying and Deleting Versioned S3 Buckets.

6. Responsible AI GRC Checks Do Not Appear in the Report

Symptoms: The report does not include the Responsible AI GRC section or any FS- findings.

Note on names. The feature is enabled with the EnableResponsibleAIGRCAssessment deployment parameter, which CodeBuild passes to Step Functions as the "enableResponsibleAIGRC" execution input. Its results are in responsible_ai_grc_security_report_*.csv. The legacy EnableFinServAssessment parameter and ENABLE_FINSERV CodeBuild variable are still accepted and converted by buildspec.yml (see the alias migration guide), but the execution input never accepts a legacy "enableFinServ" key. See 6b if you start Step Functions directly with the old key.

Expected when OWASP-only: If EnableOWASPAssessment=true and EnableResponsibleAIGRCAssessment=false, the FS- assessment still runs as a source for OWASP, but the Responsible AI GRC section, FS- rows, and responsible_ai_grc_security_report_*.csv are intentionally left out of the report bucket.

Solutions:

6b. Execution Fails with LegacyEnableFinServInputRejected

Symptoms: The Step Functions execution fails with the error LegacyEnableFinServInputRejected, and no report is generated for any service or region: Amazon Bedrock, Amazon SageMaker AI, Amazon Bedrock AgentCore, AWS Agent Registry, Responsible AI GRC, and OWASP.

Cause: The StartExecution input included "enableFinServ": "true", the execution-input name used before Responsible AI GRC was renamed. The state machine rejects it with a Fail state inside the parallel per-region assessments, which fails the whole Scan Regions Map state, so the report step never runs.

Only the CloudFormation parameter EnableFinServAssessment and the CodeBuild variable ENABLE_FINSERV are kept as legacy aliases; buildspec.yml converts them to "enableResponsibleAIGRC" before calling StartExecution. This failure happens only when something calls StartExecution directly and bypasses CodeBuild, such as a hand-written script, an old runbook, or a direct AWS CLI or SDK call.

The failure is deliberate. Without it, an execution using the old key would succeed but silently report no Responsible AI GRC findings.

Solutions:

7. TargetRegions Validation or Unexpected Region Coverage

Symptoms: CodeBuild fails with a TARGET_REGIONS validation error, or the report covers fewer or different regions than expected.

The deployment is validated only in the standard AWS commercial partition. TargetRegions controls regional coverage within that partition; it does not enable AWS GovCloud (US) or AWS China.

Solutions:

8. CodeBuild Source or GitHub Branch Failures

Symptoms: CodeBuild fails before SAM build, or the logs show repository clone or source errors.

Solutions:

9. CodeBuild Timeout or Out-of-Memory with Many Accounts

Symptoms: The CodeBuild job times out or runs slowly when scanning many accounts.

Cause: CodeBuild deploys account stacks sequentially and starts each account’s Step Functions execution without waiting for the previous one. Executions can overlap, but deployment and post_build result collection still take longer as the account count grows. The ConcurrentAccountScans parameter selects the CodeBuild compute type; it does not control execution concurrency. The template passes PARALLEL_ACCOUNTS to CodeBuild, but buildspec.yml does not use it.

ConcurrentAccountScans CodeBuild compute type Approximate cost per build minute
Three (default) BUILD_GENERAL1_SMALL $0.005
Six BUILD_GENERAL1_MEDIUM $0.01
Twelve BUILD_GENERAL1_LARGE $0.02

Solutions:

10. No Reports in S3 Bucket

Symptoms: The assessment completes, but no HTML or CSV files appear.

Solutions:

  1. Wrong bucket: use the AssessmentBucket output of the infrastructure stack, not the assessment stack (see §11).
  2. Still running: check the CodeBuild console. Multi-region, multi-account, or Responsible AI GRC-enabled assessments take longer than a single-region run.
  3. Wrong prefix: look under {account_id}/ for per-account reports and consolidated-reports/ for the multi-account consolidated HTML report.
  4. Post-build copy failed: CodeBuild copies CSV and HTML files from each account’s SAM assessment bucket into the report bucket. In multi-account mode, search the CodeBuild logs for Copying files from, Failed to copy assessment artifacts, Missing ... CSV, or No validated artifact directory found. In single-account mode, search for Failed to list bucket contents or Failed to sync results.
  5. Permissions: check CloudWatch Logs for Lambda errors and the CodeBuild logs for S3 access errors.

Note: If OWASP is enabled and Responsible AI GRC is disabled, the absence of responsible_ai_grc_security_report_*.csv in the report bucket is expected. The internal SAM assessment bucket may still contain Responsible AI GRC source files from the run; use the infrastructure stack’s bucket for results.

11. Confused by Multiple CloudFormation Stacks

Symptoms: You see several stacks and aren’t sure which one has your results.

Explanation: You create the infrastructure stack. CodeBuild then creates one AWS SAM assessment stack per assessed account, plus the AWS SAM CLI’s own artifact stack. The infrastructure stack is the one to use for reports.

Stack type How to identify What to do
Infrastructure stack (yours) The name you chose (for example, aiml-security-single-account or aiml-security-multi-account) Use this one. Open Outputs and copy AssessmentBucket
Assessment stack, single-account aiml-sec-{account_id} Internal execution stack. Its AssessmentBucketName output holds the raw reports, useful for debugging
Assessment stack, multi-account member aiml-security-{account_id}, in each member account Same as above
Assessment stack, multi-account central account aiml-security-mgmt Same as above, for the central account that runs CodeBuild (always assessed in multi-account runs)
AWS SAM CLI artifact stack aws-sam-cli-managed-default, in each assessed account Created by sam deploy --resolve-s3 to hold deployment packages. Other AWS SAM projects in the account may share it

Quick check: a stack named aiml-sec- or aiml-security- followed by an account ID, or aiml-security-mgmt, was created automatically. Look for the name you chose during deployment.

12. Upgrading an Existing Deployment to Multi-Region

See Changing an Existing Deployment to Multi-Region in the Upgrade Guide. Update TargetRegions on the existing stack; no teardown is required.

13. No “Changes Since Last Assessment” Report

Symptoms: A run completed, but no security_assessment_changes_*.html or .csv appears in the account’s folder.

Solution: Search the CodeBuild log for Changes report; the line explains why. The first run for an account never has a report. For every message and what to do, see Build log messages.


14. AC-34 or AC-35 Rows Say EnableAgentCoreArtifactObjectReads is false

Symptoms: AC-34 code archive and container image rows, or AC-35 rows for a tool schema stored in S3, are informational N/A and name EnableAgentCoreArtifactObjectReads.

Cause: The parameter defaults to false. The AgentCore role then holds no s3:GetObject, s3:GetObjectVersion, ecr:BatchGetImage or ecr:GetDownloadUrlForLayer, so the scan does not read object or image layer contents. ecr:DescribeImages is granted either way.

Solution: Set EnableAgentCoreArtifactObjectReads to true on deployment/aiml-security-single-account.yaml or deployment/2-aiml-security-codebuild.yaml, then start CodeBuild. The S3 grant covers arn:${AWS::Partition}:s3:::*/*, so the role can read any object whose bucket policy admits it; review that before turning it on.

15. AISF-00 “AISF Derived Control Coverage” Row in the Report

Symptoms: The AWS AI Security Framework section shows an N/A AISF-00 row for an account and Region, listing derived controls (for example AISF-07 and AISF-08) with “no source check was found”.

Cause: Some AISF source checks ran for that account and Region, but none of the source checks for the listed controls did. AISF-00 is a coverage marker, not a control failure. See SECURITY_CHECKS_AISF.md.

Cause What to do
The service that runs the listed source checks is deselected Nothing. A control whose source checks all belong to a deselected service gets no AISF- row and no AISF-00 mention, and the service shows as Not selected. If you still see one, the report was generated by a version before this was fixed
The service or the API behind the source check is unavailable in that Region, so the module emitted no row for that Check_ID Nothing to fix for that Region; the control is unassessed there
The source CSV for that account and Region is missing or unreadable, for example after a failed assessment Lambda Check the Step Functions execution and the S3 folder for <service>_security_report_<execution_id>_<region>.csv, fix the failure, and rerun. See No Reports in S3 Bucket

Debugging

Check CodeBuild Logs

  1. Open AWS CodeBuild > Build projects.
  2. Select your project (AIMLSecurityCodeBuild or AIMLSecurityMultiAccountCodeBuild).
  3. Open the latest build.
  4. Review the Build logs tab for errors.

Verify Cross-Account Role Trust Policies

# In the member account, check the role trust policy
aws iam get-role --role-name AIMLSecurityMemberRole --query 'Role.AssumeRolePolicyDocument'

The trust policy should allow the central CodeBuild role:

{
  "Effect": "Allow",
  "Principal": {
    "AWS": "arn:aws:iam::<central-assessment-account-id>:root"
  },
  "Action": "sts:AssumeRole",
  "Condition": {
    "ArnEquals": {
      "aws:PrincipalArn": "arn:aws:iam::<central-assessment-account-id>:role/service-role/MultiAccountCodeBuildRole"
    }
  }
}

Check S3 Bucket Permissions

The infrastructure stack’s bucket is the report bucket. In multi-account mode, member accounts do not write to it directly. CodeBuild assumes the member role in each account, copies report files from that account’s SAM assessment bucket, and uploads them to the central bucket.

If the upload fails, check the central bucket policy and the CodeBuild role’s S3 permissions:

aws s3api get-bucket-policy --bucket <infrastructure-assessment-bucket-name>

If per-account reports are missing, also open the account’s SAM assessment stack, find its AssessmentBucketName output, and confirm that the files were created there.

Investigate Incomplete Control Findings

An informational N/A row whose finding name ends in Incomplete means the scanner could not establish whether that control passed or failed. These rows use the affected control’s ID so the missing evidence is visible without adding to the failure count. They come from:

An AgentCore row that names LambdaTimeoutApproaching, or says the Lambda timeout was approaching, identifies evidence left unread near the 900-second limit. This includes another Region that an AC-18, AC-26, AC-46, AC-47, AC-48, or AC-51 cross-Region read did not reach. Rows for resources already read remain in the report. About 30 seconds before the hard timeout, the watchdog attempts to write those rows with an Incomplete row for each unfinished leg, including the leg still running and account-wide Global checks. Rerun the assessment, or assess fewer Regions per run with TargetRegions.

Find the matching Lambda invocation in the Step Functions execution and review its CloudWatch logs. Fix the missing SAM Lambda permission, unavailable API, throttling, malformed input, or code error shown there, and run the assessment again. An incomplete row is not evidence that the workload is compliant.

Investigate Incomplete IAM Permission Cache Findings

The identity-based controls for Amazon Bedrock, Amazon SageMaker AI, Amazon Bedrock AgentCore, AWS Agent Registry, and Responsible AI GRC read permissions_cache_<execution-id>.json from the account’s SAM assessment bucket. If that object is missing, unreadable, malformed, or lacks the expected role and user lists, the affected controls appear as informational N/A rows instead of passes.

Review the IAM Permission Caching task in the Step Functions execution and check the caching Lambda logs for a successful write of that execution’s object. The report Lambda deletes the cache when report generation finishes, so its absence after a completed run is expected. Fix the IAM or S3 error and run the complete assessment again; do not reuse a cache from another execution.

A cache can load while individual principal reads remain incomplete. It records each affected role or user in principal_errors, with the failed stage and error. A failed group policy read appears under each member with stage group_policy and names the group and policy. A role or user deleted during the run (NoSuchEntity) is omitted from the cache. Controls that judge all principals name those left unread and withhold a Passed row. Check the IAM Permission Caching Lambda logs for the underlying denial or throttling. Caches written before cache_schema_version 2 have no principal_errors; their findings say that per-principal read errors were not recorded.

Monitor AWS Step Functions Executions

  1. Open AWS Step Functions in the assessed account and deployment region.
  2. Find the state machine whose name starts with AIMLAssessmentStateMachine-. CloudFormation adds a random suffix. You can also find its ARN in the AIMLAssessmentStateMachineArn output, or the AIMLAssessmentStateMachine resource, of the SAM assessment stack.
  3. Review the execution history for failures.
  4. Check the results of individual Lambda invocations.

Moved Sections

These sections moved to their own documents. The anchors below keep older links working.