

# Managing evidence in AWS Assurance

Evidence is the documentation that AWS Assurance uses, alongside the configuration of your AWS resources, to evaluate whether a control is met. You can upload a document directly, or you can connect an Amazon S3 bucket that you already own and reference objects in it. You can also use documents from GitHub and SharePoint. For more information, see [Connecting GitHub and SharePoint in AWS Assurance](third-party-connections.md).

AWS Assurance never writes to a bucket that you own. It stores uploaded documents in an evidence store that it manages. It treats every bucket that you connect as read-only.

**Topics**
+ [Evidence types and lifecycle](#evidence-types-and-lifecycle)
+ [Uploading evidence](#uploading-evidence)
+ [Linking evidence to controls](#linking-evidence-to-controls)
+ [Connecting an Amazon S3 bucket as an evidence source](#evidence-management-s3-sources)
+ [Managing S3 sources](#evidence-management-managing-s3-sources)
+ [Browsing an S3 source in AWS Assurance](#evidence-management-browse-source)
+ [Troubleshooting S3 sources](#evidence-management-troubleshooting)
+ [Deleting evidence and retention](#evidence-management-retention)

## Evidence types and lifecycle
<a name="evidence-types-and-lifecycle"></a>

AWS Assurance supports the following types of evidence.


| Type | Where the content is stored | How you add it | 
| --- | --- | --- | 
| Uploaded document | The AWS Assurance evidence store | You upload the file content directly. | 
| S3 reference | Your S3 bucket | You connect the bucket as an S3 source, and then reference an object in it. | 
| GitHub or SharePoint document | Your GitHub repository or SharePoint site | You connect GitHub or SharePoint, and then choose the document. | 

Every piece of evidence has a status that indicates whether an assessment can use it.

 `SCANNING`   
AWS Assurance is scanning the content for malware. The evidence isn’t usable yet.

 `VALID`   
The content is scanned and usable. AWS Assurance might still be linking it to controls.

 `VALID_AUTO_ANALYZED`   
The content is scanned and usable, and AWS Assurance has analyzed it and linked it to controls.

 `NOT_AUTO_ANALYZED`   
The content is usable, but it’s too large or complex for AWS Assurance to link it to controls. Link it yourself.

 `QUARANTINED`   
The scan detected malware. AWS Assurance doesn’t analyze the content, and deletes it after 90 days.

 `SCAN_FAILED`   
The scan couldn’t complete, for example because the file is password protected. AWS Assurance doesn’t link the file to controls. Link it yourself, or upload a file that can be scanned.

Evidence is versioned. When you upload new content for an existing evidence ID, AWS Assurance creates a new version. Control links and assessments resolve against the latest version.

## Uploading evidence
<a name="uploading-evidence"></a>

Upload evidence to document compliance activities, such as a signed access review, so that assessments and auditors can verify that a control is met. You can upload evidence in the web application, attach it in the chat agent, or call the `PutEvidence` operation.

The maximum file size is 10 MB. This limit applies both to content that you upload and to objects that you reference in your own bucket.

### Supported file types
<a name="supported-file-types"></a>

AWS Assurance supports the following file types.

Documents  
 `pdf`, `doc`, `docx` 

Spreadsheets  
 `xls`, `xlsx`, `csv` 

Text and markup  
 `txt`, `md`, `json`, `xml`, `html`, `yaml`, `yml` 

Infrastructure as code  
 `tf`, `hcl` 

Images  
 `png`, `jpg`, `jpeg`, `gif` 

AWS Assurance determines the type of a file by inspecting its contents, not by reading its extension. The extension determines which content types are acceptable, and the detected content type must match it. As a result, AWS Assurance rejects a file that you rename to an allowed extension. If you supply a content type with the upload, AWS Assurance checks it against the detected type instead of trusting it.

### Scanned and image-only PDFs
<a name="scanned-and-image-only-pdfs"></a>

You can upload a PDF that contains only page images, such as a scan, in the same way as any other PDF. How an assessment reads it depends on the text that it contains:
+ AWS Assurance reads a PDF that has a usable text layer directly.
+ For a PDF that mixes text with page images, AWS Assurance transcribes the image pages and merges the result with the text layer.
+ For a PDF that has no usable text layer, AWS Assurance transcribes the content from the page images.

### Uploading evidence in the web application
<a name="evidence-management-upload-web-app"></a>

**To upload evidence in the web application**

1. In the navigation pane, choose **Compliance Readiness**, and then choose the **Evidence** tab.

1. Choose **Add evidence**.

1. Add your files, or choose documents from a connected source, and then choose **Review**.

1. Choose how to link the evidence:
   + To have AWS Assurance link each document to the controls that it supports, keep **Auto-linking is on**, and then choose **Add to evidence store**.
   + To choose the controls yourself, turn off auto-linking, choose the controls, and then choose **Add & link**.

To add evidence for a single control, open the control, choose the **Evidence** tab, and then choose **Add evidence**. To add evidence for a task, choose **Add evidence** on the task. Evidence that you add this way is linked to that control.

To add evidence from the chat agent, attach the file in the chat panel. For more information, see [Chat agent](chat-agent.md).

### Uploading evidence with the AWS CLI
<a name="uploading-evidence-with-the-aws-cli"></a>

The following example uploads a document and links it to a control.

```bash
aws assurance put-evidence \
    --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \
    --project <project-name> \
    --title "Access review Q3" \
    --description "Quarterly user access review, signed" \
    --content fileb://access-review-q3.pdf \
    --content-mime-type application/pdf \
    --control-references '[{"framework": "AWS:PCI-DSS", "frameworkVersion": "4", "controlId": "8.2.1"}]'
```

The `content` parameter takes a blob. Use the `fileb://` prefix so that the AWS CLI reads the file as raw bytes. If you pass the contents of a file inline as a string, the request fails with a base64 encoding error.

To upload a new version of existing evidence, include the `evidenceId` parameter with the ID that the first upload returned.

## Linking evidence to controls
<a name="linking-evidence-to-controls"></a>

Evidence affects an assessment only for the controls that it’s linked to. By default, AWS Assurance analyzes the evidence that you add and links it to the controls that it’s relevant to. This applies to uploaded documents, to S3 references, and to GitHub and SharePoint documents. A link doesn’t mean that the control is met. The next assessment decides that. Automatic links might not always be accurate, so review them, and add or remove links as needed.

In the web application, the **Linked to** column of the **Evidence** tab shows how many controls each document is linked to, and whether AWS Assurance or a user created the links. To review or change the links, choose the number of controls.

With the API, you can create links when you upload the evidence by using the `controlReferences` parameter, or afterward by calling `UpdateEvidence`. To link evidence only to the controls that you choose, set `linkMode` to `MANUAL`.

```bash
aws assurance update-evidence \
    --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \
    --project <project-name> \
    --evidence-id <evidence-id> \
    --add-control-reference-links '[{"framework": "AWS:PCI-DSS", "frameworkVersion": "4", "controlId": "8.2.2"}]' \
    --remove-control-reference-links '[{"framework": "AWS:PCI-DSS", "frameworkVersion": "4", "controlId": "8.2.1"}]'
```

## Connecting an Amazon S3 bucket as an evidence source
<a name="evidence-management-s3-sources"></a>

If your compliance artifacts are already stored in Amazon S3, you can connect them as an S3 source. Connect a bucket, or a prefix within a bucket, to your environment. You can then reference objects in it as evidence instead of uploading them again.

### How S3 sources work
<a name="how-s3-sources-work"></a>

An S3 source has the following characteristics:
+ An S3 source is read-only. AWS Assurance reads object metadata and content. It never writes, tags, or deletes anything in your bucket.
+ The bucket must be in the same AWS Region as the environment.
+ A reference must fall within a connected prefix. For example, if you connect `s3://amzn-s3-demo-bucket/compliance/`, then AWS Assurance accepts `s3://amzn-s3-demo-bucket/compliance/soc2/report.pdf` and rejects `s3://amzn-s3-demo-bucket/other/report.pdf`.
+ If you connect the same bucket and prefix twice, AWS Assurance keeps one source.
+ The bucket can be in another AWS account, including an account outside your organization.
+ In an organization environment, only the organization’s management account can add or remove an S3 connection. A delegated administrator account can’t.

### How AWS Assurance reaches your bucket
<a name="how-aws-assurance-reaches-your-bucket"></a>

Each S3 request to your bucket uses the credentials of the principal that calls the operation. It doesn’t run as a service principal. Grant each principal the actions for the operations that it calls.

The following table lists each operation and the principal that runs it. Each principal needs the listed actions on the bucket or object Amazon Resource Name (ARN).


| Operation | Principal | Required actions | 
| --- | --- | --- | 
| Connecting the bucket, with `CreateEnvironmentConnection`  | The identity that you’re signed in as |  `s3:ListBucket` and `s3:GetBucketLocation` on the bucket ARN | 
| Browsing the source, with `ListConnectionItems`  | The operator access role and the IAM Identity Center role of the environment |  `s3:ListBucket` on the bucket ARN | 
| Referencing, assessing, and opening an object, with `PutEvidence`, `GetEvidenceContent`, and assessments | The operator access role, the IAM Identity Center role, and the service-linked role `AWSServiceRoleForAssurance`  |  `s3:GetObject` on the object ARN | 

The bucket policy therefore has two statements, split by resource level. One statement is for the bucket ARN, and one is for the object ARN. The service-linked role gets object-level access only. It never connects or browses the source, so don’t grant it bucket-level actions.

Which roles each policy names depends on whether the bucket is in the same account as the environment. When you connect a bucket, AWS Assurance attaches a policy to its service-linked role that grants that role access to the bucket. It attaches the policy with your credentials, so you also need `iam:PutRolePolicy` on the service-linked role. For a bucket in the same account, that policy is enough, so the bucket policy doesn’t need to name the service-linked role. The console’s sample policy names it anyway, because the console can’t tell which account owns the bucket.

The following table lists the roles for a single-account environment.


| Policy | Same-account bucket | Cross-account bucket | 
| --- | --- | --- | 
| Bucket policy, bucket-level statement (Step 1) | The role that you sign in as to connect the bucket, the operator access role, and the IAM Identity Center role | The role that you sign in as to connect the bucket, the operator access role, and the IAM Identity Center role | 
| Bucket policy, object-level statement (Step 1) | The operator access role and the IAM Identity Center role. The service-linked role is optional. | The operator access role, the IAM Identity Center role, and the service-linked role | 
| Identity-based policies (Step 2) | None | The role that you sign in as to connect the bucket, the operator access role, and the IAM Identity Center role | 
| Key policy, for a bucket that a customer managed key encrypts (Step 3) | The operator access role, the IAM Identity Center role, and the service-linked role | The operator access role, the IAM Identity Center role, and the service-linked role | 

The connection check validates only the bucket-level access. A source can show a status of `ACTIVE` while object reads fail. Complete every step in this section before you reference objects.

**Copy role ARNs from the console**  
Copy the role ARNs from the console instead of building them from an account ID and a role name. Some roles include an IAM path. An assembled ARN is then wrong in exactly the cases that are hardest to diagnose. To find the ARNs, open your environment, choose **Add connection** in the **Connections** section, and then choose **Amazon S3**. In the **Amazon S3 source** panel, expand **Required bucket policy**. The panel fills in the role ARNs for your environment and your bucket name.  
For a single-account environment, the panel shows the service-linked role `AWSServiceRoleForAssurance` in the account of the environment.  
For an organization environment, grant object-level access to the service-linked role of each participating account, as Step 1 describes.  
Your environment might not yet have an operator access role or an IAM Identity Center role. In that case, the panel shows only the connection-check policy. Configure the roles first. Configure the operator access role in the **Permissions** section of the environment page. Configure the IAM Identity Center role in the **Identity Center access** section.

If one bucket is a source for more than one environment, the roles of every environment need the grant. A bucket policy that names the roles of only one environment denies the others.

To connect a bucket, complete the following steps. Complete Steps 2 and 3 only if they apply to your bucket.

1.  [Step 1](#evidence-management-s3-step1) adds a bucket policy that grants access. This step is required.

1.  [Step 2](#evidence-management-s3-step2) adds identity-based policies for a cross-account bucket.

1.  [Step 3](#evidence-management-s3-step3) grants `kms:Decrypt` for a bucket that a customer managed key encrypts.

1.  [Step 4](#evidence-management-connect-bucket) connects the bucket to your environment.

1.  [Step 5](#evidence-management-s3-step5) references an object as evidence.

### Step 1: Add a bucket policy
<a name="evidence-management-s3-step1"></a>

This policy is required in all cases. It has two statements, split by resource level: one grants the bucket-level actions, and the other grants the object-level action. If the bucket already has a policy, add these statements instead of replacing it. Apply the following JSON bucket policy to the source bucket:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AssuranceValidateSourceBucket",
      "Effect": "Allow",
      "Principal": {
        "AWS": [
          "arn:aws:iam::111122223333:role/ExampleAdminRole",
          "arn:aws:iam::111122223333:role/ExampleOperatorAccessRole",
          "arn:aws:iam::111122223333:role/ExampleIdentityCenterRole"
        ]
      },
      "Action": ["s3:ListBucket", "s3:GetBucketLocation"],
      "Resource": "arn:aws:s3:::amzn-s3-demo-bucket"
    },
    {
      "Sid": "AssuranceReadSourceObjects",
      "Effect": "Allow",
      "Principal": {
        "AWS": [
          "arn:aws:iam::111122223333:role/ExampleOperatorAccessRole",
          "arn:aws:iam::111122223333:role/ExampleIdentityCenterRole",
          "arn:aws:iam::111122223333:role/aws-service-role/assurance.amazonaws.com/AWSServiceRoleForAssurance"
        ]
      },
      "Action": ["s3:GetObject"],
      "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/compliance/*"
    }
  ]
}
```

Replace the example values with your own values:

 {{111122223333}}   
The ID of the account that owns the roles, which is the account of the environment.

 {{amzn-s3-demo-bucket}}   
The name of your bucket.

 {{compliance/}}   
The prefix that you connected. If you connected the whole bucket, the object resource is `arn:aws:s3:::amzn-s3-demo-bucket/*`.

 {{arn:aws:iam::111122223333:role/ExampleAdminRole}}   
The full ARN of the role that you’re signed in as when you connect the bucket.

 {{arn:aws:iam::111122223333:role/ExampleOperatorAccessRole}} and {{arn:aws:iam::111122223333:role/ExampleIdentityCenterRole}}   
The ARNs of the operator access role and the IAM Identity Center role of the environment.

 {{arn:aws:iam::111122223333:role/aws-service-role/assurance.amazonaws.com/AWSServiceRoleForAssurance}}   
The service-linked role in the account of the environment. It’s optional for a bucket in the same account. In an organization environment, list the service-linked role of each participating account instead.

Note the following about the action lists:
+  `s3:GetBucketLocation` is required. The access denied error names only `s3:ListBucket`, so a policy written from that message alone still fails.
+  `s3:GetObjectVersion` isn’t required. AWS Assurance never reads a specific object version.
+ Don’t add an `s3:prefix` condition to the bucket-level statement. Browsing lists one folder level at a time, with a different prefix at each level. The condition therefore refuses every level below the connected prefix.
+ One statement that puts all three actions on both ARNs grants nothing more. `s3:GetObject` applies only to object ARNs, and `s3:ListBucket` and `s3:GetBucketLocation` apply only to the bucket ARN.

If the bucket and the principals are in the same account, this policy authorizes the access on its own. Continue to [Step 4: Connect the bucket](#evidence-management-connect-bucket), unless a customer managed key encrypts the bucket.

### Step 2: Add identity-based policies for a cross-account bucket
<a name="evidence-management-s3-step2"></a>

A cross-account request to your source bucket is a direct call that carries the expected bucket owner. It isn’t a role assumption. For this reason, two policies must allow each action. These are the bucket policy, and an identity-based policy in the account of the calling principal. [Step 1](#evidence-management-s3-step1) grants the access on the bucket. The following policies grant it on the identity.

Attach the following JSON identity-based policy to the role that you’re signed in as when you connect the bucket:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AssuranceValidateCrossAccountSourceBucket",
      "Effect": "Allow",
      "Action": ["s3:ListBucket", "s3:GetBucketLocation"],
      "Resource": "arn:aws:s3:::amzn-s3-demo-bucket"
    }
  ]
}
```

Replace {{amzn-s3-demo-bucket}} with the name of your bucket.

Attach the following JSON identity-based policy to the operator access role and the IAM Identity Center role of the environment:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AssuranceBrowseCrossAccountSourceBucket",
      "Effect": "Allow",
      "Action": ["s3:ListBucket"],
      "Resource": "arn:aws:s3:::amzn-s3-demo-bucket"
    },
    {
      "Sid": "AssuranceReadCrossAccountSourceObjects",
      "Effect": "Allow",
      "Action": ["s3:GetObject"],
      "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/compliance/*"
    }
  ]
}
```

Replace the example values with your own values:

 {{amzn-s3-demo-bucket}}   
The name of your bucket.

 {{compliance/}}   
The prefix that you connected. If you connected the whole bucket, the object resource is `arn:aws:s3:::amzn-s3-demo-bucket/*`.

Without the `AssuranceBrowseCrossAccountSourceBucket` statement, browsing the source fails even when the bucket policy is correct.

Don’t attach a policy to the `AWSServiceRoleForAssurance` service-linked role. It can’t take a customer-attached policy, and AWS Assurance configures its identity side when you connect the bucket.

### Step 3: Grant kms:Decrypt for an encrypted bucket
<a name="evidence-management-s3-step3"></a>

If a customer managed key encrypts the source bucket, the key policy must permit the access. A bucket policy can’t express AWS Key Management Service (AWS KMS) actions. This is therefore a separate change, and nothing in Step 1 substitutes for it.

Add the following JSON statement to the `Statement` array of the key’s existing key policy. Don’t replace the existing policy: a key policy that no longer names your administrative principals can leave the key unmanageable.

```json
{
  "Sid": "AssuranceDecryptSourceObjects",
  "Effect": "Allow",
  "Principal": {
    "AWS": [
      "arn:aws:iam::111122223333:role/ExampleOperatorAccessRole",
      "arn:aws:iam::111122223333:role/ExampleIdentityCenterRole",
      "arn:aws:iam::111122223333:role/aws-service-role/assurance.amazonaws.com/AWSServiceRoleForAssurance"
    ]
  },
  "Action": ["kms:Decrypt"],
  "Resource": "*"
}
```

Use the same role ARNs that you listed in [Step 1](#evidence-management-s3-step1). Amazon S3 calls `kms:Decrypt` with the credentials of the requester when it serves the object. The key policy therefore names the same principals that read objects. Include the service-linked role even if you left it out of the bucket policy.

For a cross-account bucket, a key policy alone grants no access to a principal in another account. A policy in that principal’s own account must also grant it. Don’t attach this policy to the `AWSServiceRoleForAssurance` service-linked role. Attach the statement in the following JSON identity policy to the operator access role and the IAM Identity Center role:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AssuranceDecryptSourceObjectsViaIam",
      "Effect": "Allow",
      "Action": ["kms:Decrypt"],
      "Resource": "arn:aws:kms:us-east-1:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab"
    }
  ]
}
```

Replace the example values with your own values:

 {{us-east-1}}   
The Region of the bucket.

 {{444455556666}}   
The ID of the account that owns the bucket and its key.

 {{1234abcd-12ab-34cd-56ef-1234567890ab}}   
The ID of the key.

 `kms:Decrypt` is the only AWS KMS action that a source bucket requires. Neither `kms:GenerateDataKey` nor `kms:DescribeKey` is required.

### Step 4: Connect the bucket
<a name="evidence-management-connect-bucket"></a>

#### To connect a bucket in the console
<a name="to-connect-a-bucket-in-the-console"></a>

1. Open the [AWS Assurance console](https://console.aws.amazon.com/assurance/), and then choose **Environments**.

1. Choose the name of your environment.

1. In the **Connections** section, choose **Add connection**.

1. Under **Select a connector**, choose **Amazon S3**.

1. For **S3 bucket**, choose a bucket from your account, or enter a URI for a bucket in another account.

1. For **Expected bucket owner**, enter the 12-digit ID of the account that owns the bucket. This value is required for a bucket in another account.

1. Choose **Connect**.

#### To connect a bucket with the AWS CLI
<a name="to-connect-a-bucket-with-the-aws-cli"></a>

Run the following AWS CLI command:

```bash
aws assurance create-environment-connection \
    --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \
    --provider-config '{"s3": {"sourceUri": "s3://<bucket-name>/compliance/", "expectedBucketOwner": "<bucket-owner-account-id>"}}'
```

Replace {{<bucket-name>}} with your bucket name and {{<bucket-owner-account-id>}} with the ID of the account that owns it. For a bucket in the same account as the environment, `expectedBucketOwner` is optional. It defaults to the account that you’re signed in to.

The operation returns a status of `ACTIVE` after AWS Assurance confirms the access. If the check fails, AWS Assurance creates no source, and the error describes what to correct. For more information, see [Troubleshooting S3 sources](#evidence-management-troubleshooting).

The expected bucket owner protects you against bucket-name reuse. If the original owner releases a bucket name, another account can register it. This value then prevents AWS Assurance from reading the new bucket. AWS Assurance sends this value with every S3 request against the source.

**Provide the correct expected bucket owner**  
Amazon S3 checks the expected bucket owner before it evaluates the bucket policy. If the value names the wrong account, Amazon S3 rejects the request, and AWS Assurance returns an access denied error. No change to a bucket policy or a key policy can fix a wrong value. The **Required bucket policy** section of the **Amazon S3 source** panel shows an **If access is still denied** alert. This alert describes the check. To correct the value, remove the source and connect the bucket again. For more information, see [Managing S3 sources](#evidence-management-managing-s3-sources).

### Step 5: Reference an object as evidence
<a name="evidence-management-s3-step5"></a>

To use an object in a connected source as evidence, reference it instead of uploading content. The `reference` and `content` parameters are mutually exclusive.

```bash
aws assurance put-evidence \
    --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \
    --project <project-name> \
    --title "SOC 2 Type II report" \
    --reference s3://<bucket-name>/compliance/soc2/report.pdf \
    --control-references '[{"framework": "AWS:PCI-DSS", "frameworkVersion": "4", "controlId": "12.8.5"}]'
```

The reference must be a complete object key under a connected prefix. The object must be 10 MB or smaller. If you edit the object after you reference it, see [Updating a document in an S3 source](#evidence-management-s3-object-updates).

To find the key of an object in a connected source, see [Browsing an S3 source in AWS Assurance](#evidence-management-browse-source).

### Updating a document in an S3 source
<a name="evidence-management-s3-object-updates"></a>

When you link a document from S3, AWS Assurance evaluates the version that you linked. AWS Assurance records the object’s checksum when you link it, and detects a change on a later read. Editing the object in Amazon S3 after you link it doesn’t update the evidence or any later assessment. This applies in both assessment modes. To record the current version, add the document from S3 again. You then get a new version of the same evidence item. The new version keeps the control links that it already had.

**Continuous mode updates**  
When a framework uses Continuous mode, updating a document in Amazon S3 doesn’t automatically refresh the linked evidence. It also doesn’t start an assessment. You must add the document from S3 again.

Until you add the document again, assessments use the text that AWS Assurance stored for the linked version. AWS Assurance doesn’t read the edited object. You don’t get a notification, a status change, or a field update when the object changes.

To add the document again, use the console or the AWS CLI.

**To add the document again in the console**

1. On the control, choose **Add evidence**.

1. Choose the same object from the same connection.

**To add the document again with the AWS CLI**

1. Call `PutEvidence` with the same `--reference` and no `--evidence-id`:

   ```bash
   aws assurance put-evidence \
       --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \
       --project <project-name> \
       --title "SOC 2 Type II report" \
       --reference s3://<bucket-name>/compliance/soc2/report.pdf \
       --control-references '[{"framework": "AWS:PCI-DSS", "frameworkVersion": "4", "controlId": "12.8.5"}]'
   ```

Don’t pass `evidenceId`. The S3 URI identifies the evidence item, so the call records a new version. `UpdateEvidence` doesn’t record a new version, so don’t use it for this.

What happens next depends on the assessment mode of the framework:

Continuous (`CONTINUOUS`)  
The new version starts an assessment of the linked controls automatically.

Daily (`SCHEDULED`)  
The new version is used in the next daily assessment, which can be up to 24 hours later. To use it sooner, start an assessment.

If you open the evidence before you add the document again, the request fails. For the message, see [Troubleshooting S3 sources](#evidence-management-troubleshooting).

For more information about assessment modes, see [Choosing an assessment mode](frameworks.md#choosing-an-assessment-mode).

## Managing S3 sources
<a name="evidence-management-managing-s3-sources"></a>

To list the S3 sources of an environment, call `ListEnvironmentConnections`. Each entry returns the connection type, status, creation time, and an `s3` object that describes the source. The `s3` object contains the following fields:

 `sourceUri`   
The S3 URI that you connected. To remove the source, pass this value to `DeleteEnvironmentConnection` in `providerConfig`.

 `expectedBucketOwner`   
The account ID that you specified as the expected bucket owner. This field is absent if you didn’t specify an expected bucket owner when you connected the source.

```bash
aws assurance list-environment-connections \
    --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \
    --filters '[{"name": "connection-type", "values": ["s3"]}]'
```

In the console, the **Connections** section of the environment page lists your sources with **Type**, **Account / URI**, **Status**, **Scope**, and **Date created** columns.

To remove a source, call `DeleteEnvironmentConnection`. In the console, select the source in the **Connections** section and choose **Remove**.

```bash
aws assurance delete-environment-connection \
    --environment-arn arn:aws:assurance:<region>:<account-id>:environment/<environment-id> \
    --provider-config '{"s3": {"sourceUri": "s3://<bucket-name>/compliance/"}}'
```

**Removing a source affects existing evidence**  
Removing a source affects existing evidence that references it. Removing a source deletes no evidence record, and removes no content from your bucket. However, the source is the only place where AWS Assurance stores the account that owns the bucket. As a result:  
For a bucket in the same account as the environment, existing evidence remains readable.
For a bucket in another account, existing evidence that references objects in that bucket stops being readable. It returns an access denied error. To restore access, connect the bucket again with the same URI and expected bucket owner. Before you remove the source, note the `s3.expectedBucketOwner` value that `ListEnvironmentConnections` returns for it.
In both cases, AWS Assurance rejects new references under the prefix that you removed.

There is no operation that modifies an existing source. To change a prefix or an expected bucket owner, remove the source and connect the bucket again.

## Browsing an S3 source in AWS Assurance
<a name="evidence-management-browse-source"></a>

To find an object in an S3 source when you do not know its key, call `ListConnectionItems`. The operation lists the folders and objects in the source, one level at a time. Identify the source in `providerConfig` with its `sourceUri`, and use the value exactly as `ListEnvironmentConnections` returns it. If the environment has no S3 source with that URI, the request fails.

Omit `parentId` to list the top level of the source, which is the bucket or prefix that you connected. Each item has an `id`, a `name`, and a `kind`, and the `kind` is `FOLDER` or `FILE`. To list the contents of a folder, pass the `id` of the folder as `parentId`. A `FILE` has no contents, so if you pass the `id` of a `FILE` as `parentId`, the request fails. Treat each `id` as an opaque value, and use it only with the source that returned it. To get more items at the same level, pass the `nextToken` from the response in a new request. Use the same source and `parentId`.

A `FILE` item also has a `url`, a `sizeBytes` value, and an `updatedAt` timestamp. The `url` is the S3 URI of the object. To use the object as evidence, pass the `url` to `PutEvidence` as the reference, as Step 5 shows.

 `ListConnectionItems` runs with the credentials of the caller. In the web application, you browse as the IAM Identity Center role or the operator access role of the environment. Those roles need `s3:ListBucket` on the bucket, which the `AssuranceValidateSourceBucket` statement from [Step 1](#evidence-management-s3-step1) grants.

**Note**  
To use this operation, you must have the `s3:ListBucket` permission on the bucket.

If you call `ListConnectionItems` with the AWS CLI as another identity, grant that identity `s3:ListBucket` on the bucket. For a cross-account bucket, also add the `AssuranceBrowseCrossAccountSourceBucket` statement from [Step 2](#evidence-management-s3-step2) to a policy in that identity’s account.

If you do not have the `s3:ListBucket` permission on the bucket, the request fails. To fix this error, do the following:

1. Grant `s3:ListBucket` to your identity, as described in the previous paragraph.

1. Send the request again.

For more information about S3 source errors, see [Troubleshooting S3 sources](#evidence-management-troubleshooting).

### Browsing Amazon S3 sources with the AWS CLI
<a name="evidence-management-browse-source-cli"></a>

To browse an S3 source with the AWS Command Line Interface (AWS CLI), use the following procedure. The procedure lists the top level of the source, and then it lists the contents of one folder. Before you begin, install and configure the AWS CLI. You must have the `assurance:ListConnectionItems` permission and the `s3:ListBucket` permission on the bucket. For more information about installation, see [Getting started with the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) in the *AWS Command Line Interface User Guide for Version 2*.

By default, the AWS CLI gets all pages of the results. For more information about pagination, see [Using the pagination options in the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html) in the *AWS Command Line Interface User Guide for Version 2*. For more information about the parameters of `ListConnectionItems`, see the [AWS Assurance API Reference](https://docs.aws.amazon.com/assurance/latest/APIReference/).

The commands use example values. In each command, replace the following values with your own values:

 {{arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111}}   
The ARN of your environment.

 {{s3://amzn-s3-demo-bucket/pci-dss/}}   
The URI of your S3 source. Use the `sourceUri` value exactly as `ListEnvironmentConnections` returns it.

**To browse S3 sources with the AWS CLI**

1. To list the top level of the source, run the following AWS CLI command in a terminal, without `--parent-id`:

   ```bash
   aws assurance list-connection-items \
       --environment-arn arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \
       --provider-config '{"s3": {"sourceUri": "s3://amzn-s3-demo-bucket/pci-dss/"}}'
   ```

   The following example output shows one folder and one file:

   ```json
   {
       "items": [
           {
               "id": "eyJsZXZlbCI6ImZvbGRlciJ9",
               "kind": "FOLDER",
               "name": "2026"
           },
           {
               "id": "eyJsZXZlbCI6ImZpbGUifQ",
               "kind": "FILE",
               "name": "scan-report.xml",
               "url": "s3://amzn-s3-demo-bucket/pci-dss/scan-report.xml",
               "sizeBytes": 810,
               "updatedAt": "2026-03-02T00:00:00+00:00"
           }
       ]
   }
   ```

1. To list the contents of a folder, run the following AWS CLI command with `--parent-id`. For the `--parent-id` value, use the `id` of a `FOLDER` item from the output of step 1:

   ```bash
   aws assurance list-connection-items \
       --environment-arn arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \
       --provider-config '{"s3": {"sourceUri": "s3://amzn-s3-demo-bucket/pci-dss/"}}' \
       --parent-id eyJsZXZlbCI6ImZvbGRlciJ9
   ```

   The following example output shows one file in the folder:

   ```json
   {
       "items": [
           {
               "id": "eyJsZXZlbCI6Im5lc3RlZCJ9",
               "kind": "FILE",
               "name": "q1-scan-report.xml",
               "url": "s3://amzn-s3-demo-bucket/pci-dss/2026/q1-scan-report.xml",
               "sizeBytes": 1024,
               "updatedAt": "2026-03-02T00:00:00+00:00"
           }
       ]
   }
   ```

If a command fails, you get an error message and a nonzero exit status. To find the cause and the resolution of an S3 source error, see [Troubleshooting S3 sources](#evidence-management-troubleshooting).

## Troubleshooting S3 sources
<a name="evidence-management-troubleshooting"></a>

The following table describes errors that you might encounter when you work with an S3 source.


| Error | Cause | Resolution | 
| --- | --- | --- | 
|  `Bucket '<bucket-name>' does not exist.`  | The bucket name is incorrect, or the bucket is in a partition or an account that you can’t reach. | Verify the bucket name. | 
|  `Access denied to bucket '<bucket-name>'. Verify the bucket policy grants the caller s3:ListBucket permission.`  | The identity that you’re signed in as can’t run the connection check. Another cause is that the expected bucket owner names the wrong account. | Apply the `AssuranceValidateSourceBucket` statement from [Step 1](#evidence-management-s3-step1). This message names only `s3:ListBucket`, but `s3:GetBucketLocation` is also required, so grant both. For a bucket in another account, also complete [Step 2](#evidence-management-s3-step2). If the policies are correct, the expected bucket owner names the wrong account. Remove the source and connect the bucket again with the correct expected bucket owner. For more information, see [Step 4: Connect the bucket](#evidence-management-connect-bucket). | 
|  `Bucket '<bucket-name>' is in region '<bucket-region>' but this service operates in '<environment-region>'. The bucket must be in the same region.`  | The bucket isn’t in the same Region as the environment. | Use a bucket in the Region of the environment, or create an environment in the Region of the bucket. | 
|  `The bucket this connection names could not be listed. Verify that it exists and that the caller is allowed s3:ListBucket on it.`  | The bucket no longer exists, or the identity that calls `ListConnectionItems` does not have `s3:ListBucket` permission on the bucket. | Verify that the bucket exists. Grant the calling identity `s3:ListBucket` on the bucket. For a bucket in another account, also add the `AssuranceBrowseCrossAccountSourceBucket` statement from Step 2. Add it to a policy in the account of the calling identity. | 
|  `S3 reference does not match any registered S3 source on this environment`  | The object key isn’t under a connected prefix, or the source was removed. | Connect the prefix that contains the object, or correct the reference. Prefix matching is exact. A source for `s3://amzn-s3-demo-bucket` doesn’t cover a bucket whose name begins with the same characters. | 
|  `Access denied to S3 object. Verify the bucket policy grants you s3:GetObject on the object, and that the S3 connection’s expectedBucketOwner is the account that owns the bucket - a mismatched owner is rejected before any bucket policy is evaluated.`  | You didn’t grant `s3:GetObject` to a role of the environment. You didn’t add `kms:Decrypt` to the key policy of the customer managed AWS KMS key that encrypts the bucket. For a cross-account bucket, you didn’t attach an identity-based policy that allows `kms:Decrypt` on the key. You entered the wrong account as the expected bucket owner. You removed a cross-account source. | To resolve the error, complete the following steps:1.  Verify that the `AssuranceReadSourceObjects` statement names every role that the console lists. Include roles that you added after you first wrote the policy. These roles are:   The operator access role.   The IAM Identity Center role.   The service-linked role, for a single-account environment.   The service-linked role of each participating account, for an organization environment.   <br />2.  If a AWS KMS key encrypts the bucket, complete [Step 3](#evidence-management-s3-step3). Do this even if the bucket policy is correct. Check the key policy and, for a cross-account bucket, the `AssuranceDecryptSourceObjectsViaIam` identity policy. The error message doesn’t mention AWS KMS. <br />3.  If the expected bucket owner names the wrong account, remove the source. Then connect the bucket again with the correct value. <br />4.  If the source was removed, connect the bucket again.  | 
| Evidence reads succeed for some users and fail for others | The bucket policy names some roles of the environment but not all of them. Another cause is that the bucket is a source for a second environment whose roles it doesn’t name. | Add every role of every environment that uses the bucket. | 
|  `S3 object not found`  | Someone deleted the object, or the key is incorrect. | Verify the object key. | 
|  `Evidence file no longer exists in S3`  | Someone deleted the object after you linked it. | Restore the object, or reference another one. | 
|  `This evidence’s S3 source is no longer connected. Connect the S3 source again to restore access.`  | You removed the source. | Connect the bucket again with the same URI and expected bucket owner. | 
|  `Evidence source has changed since version <n> was recorded. Re-upload the reference to create a new version.`  | The object changed in S3 after you linked it. AWS Assurance returns `IntegrityException`. | Add the document from S3 again. For more information, see [Updating a document in an S3 source](#evidence-management-s3-object-updates). | 
|  `Only the organization’s management account can add or remove S3 connections`  | You’re signed in to a delegated administrator account. | Sign in to the management account. | 
|  `S3 object exceeds maximum allowed size (10MB)`  | The object is larger than the evidence size limit. | Reference a smaller object, or divide the document. | 

## Deleting evidence and retention
<a name="evidence-management-retention"></a>

AWS Assurance retains evidence for as long as the project that owns it. There is no retention period to configure. AWS Assurance removes evidence only when you delete it, or when the project or the environment that owns it is deleted.

To delete a single piece of evidence, call `DeleteEvidence`. This operation removes the evidence record and, for a document that you uploaded, the stored content.

When you delete a project or an environment, AWS Assurance deletes its evidence, which includes stored content and annotations, and stops metering storage for it.

AWS Assurance never deletes an object in a bucket that you own. It deletes only the evidence record that references the object.

The following service-managed exceptions apply to content in the AWS Assurance evidence store:
+ AWS Assurance deletes content that a malware scan quarantined after 90 days.

AWS Assurance never deletes current evidence content automatically.