

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 停用 S3 Storage Lens 的受信任存取權
<a name="storage_lens_with_organizations_disabling_trusted_access"></a>

以委派的管理員身分移除帳戶或停用受信任存取，會限制帳戶擁有者的 S3 Storage Lens 儀表板指標只能在帳戶層級上運作。然後，每個帳戶持有人只能在其帳戶的有限範圍內 (而非整個組織) 看到 S3 Storage Lens 的好處。

當您在 S3 Storage Lens 中停用受信任存取時，任何需要受信任存取的儀表板都不會再更新。建立的任何組織儀表板也不會再更新。反之，您只能在 [S3 Storage Lens 儀表板的歷史資料](https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage_lens_basics_metrics_recommendations.html#storage_lens_basics_data_queries)仍然可用時進行查詢。

**注意**  
停用 S3 Storage Lens 的受信任存取權也會使所有組織層級儀表板自動停止收集和彙總儲存空間指標。這是因為 S3 Storage Lens 無法再以信任方式存取組織帳戶。
您的管理和委派管理員帳戶仍然可以查看任何已停用儀表板的歷史資料，也可以在此歷史資料仍然可用時進行查詢。

# 使用 S3 主控台
<a name="storage_lens_console_organizations_disabling_trusted_access"></a>

**停用 S3 Storage Lens 的受信任存取權**

1. 登入 AWS 管理主控台 ，並在 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)：// 開啟 Amazon S3 主控台。

1. 在左側導覽窗格上，導覽至 **Storage Lens**。

1. 選擇 **AWS Organizations 設定**。**Storage Lens 的AWS Organizations 存取**頁面隨即顯示。

1. 在 **AWS Organizations 受信任存取**下，選擇**編輯**。

   **AWS Organizations 存取**頁面隨即顯示。

1. 選擇**停用**以停用 S3 Storage Lens 儀表板的受信任存取。

1. 選擇**儲存變更**。

# 使用 AWS CLI
<a name="OrganizationsDisableTrustedAccessS3LensCLI"></a>

**Example**  
下列範例使用 AWS CLI停用 S3 Storage Lens 的受信任存取。  

```
aws organizations disable-aws-service-access --service-principal storage-lens.s3.amazonaws.com
```

# 使用適用於 Java 的 AWS 開發套件
<a name="OrganizationsDisableTrustedAccessS3LensJava"></a>

**Example – 停用 S3 Storage Lens 的 AWS Organizations 受信任存取**  
下列範例說明如何在適用於 Java 的 SDK 中停用 S3 Storage Lens 的 AWS Organizations 受信任存取。若要使用此範例，請以您自己的資訊取代 `user input placeholders`。  

```
import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.organizations.AWSOrganizations;
import com.amazonaws.services.organizations.AWSOrganizationsClient;
import com.amazonaws.services.organizations.model.DisableAWSServiceAccessRequest;

public class DisableOrganizationsTrustedAccess {
	private static final String S3_STORAGE_LENS_SERVICE_PRINCIPAL = "storage-lens.s3.amazonaws.com";

	public static void main(String[] args) {
		try {
            AWSOrganizations organizationsClient = AWSOrganizationsClient.builder()
                .withCredentials(new ProfileCredentialsProvider())
                .withRegion(Regions.US_EAST_1)
                .build();

            // Make sure to remove any existing delegated administrator for S3 Storage Lens 
            // before disabling access; otherwise, the request will fail.
            organizationsClient.disableAWSServiceAccess(new DisableAWSServiceAccessRequest()
                .withServicePrincipal(S3_STORAGE_LENS_SERVICE_PRINCIPAL));
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but AWS Organizations couldn't process
            // it and returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // AWS Organizations couldn't be contacted for a response, or the client
            // couldn't parse the response from AWS Organizations.
            e.printStackTrace();
        }
	}
}
```