

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

# 註冊 S3 Storage Lens 的委派管理員
<a name="storage_lens_with_organizations_registering_delegated_admins"></a>

您可以使用組織的管理帳戶或委派管理員帳戶，來建立組織層級儀表板。委派管理員帳戶允許管理帳戶以外的其他帳戶建立組織層級儀表板。僅組織的管理帳戶可以將其他帳戶註冊為組織的委派管理員，以及取消註冊委派管理員。

啟用受信任存取後，您可以使用 AWS Organizations REST API 或管理帳戶中SDKs AWS CLI來註冊組織中[帳戶的](https://docs.aws.amazon.com/managedservices/latest/userguide/management-account.html)委派管理員存取。(如需詳細資訊，請參閱AWS Organizations API 參考**中的[https://docs.aws.amazon.com/organizations/latest/APIReference/API_RegisterDelegatedAdministrator.html](https://docs.aws.amazon.com/organizations/latest/APIReference/API_RegisterDelegatedAdministrator.html))。當帳戶註冊為委派管理員時，帳戶會收到存取所有唯讀 AWS Organizations API 操作的授權。此授權會提供組織成員和結構的可見性，讓他們可以代表您建立 S3 Storage Lens 儀表板。

**注意**  
您必須先呼叫 [https://docs.aws.amazon.com/organizations/latest/APIReference/API_EnableAWSServiceAccess.html](https://docs.aws.amazon.com/organizations/latest/APIReference/API_EnableAWSServiceAccess.html)操作 AWS CLI，才能使用 AWS Organizations REST API 或 SDKs 指定委派管理員。

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

**註冊 S3 Storage Lens 的委派管理員**

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

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

1.  選擇 **AWS Organizations 設定**。

1. 在**委派的管理員**下，選擇**註冊帳戶**。

1. 新增 AWS 帳戶 ID 以將帳戶註冊為委派管理員。委派的管理員能夠為組織中的所有帳戶和儲存體建立組織層級儀表板。

1. 選擇**註冊帳戶**。

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

**Example**  
下列範例示範如何使用 AWS CLI註冊 S3 Storage Lens 的 Organizations 委派管理員。若要使用此範例，請以您自己的資訊取代 `user input placeholders`。  

```
aws organizations register-delegated-administrator --service-principal storage-lens.s3.amazonaws.com --account-id 111122223333
```

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

**Example – 註冊 S3 Storage Lens 的 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.RegisterDelegatedAdministratorRequest;

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

	public static void main(String[] args) {
		try {
            String delegatedAdminAccountId = "111122223333"; // Account Id for the delegated administrator.
            AWSOrganizations organizationsClient = AWSOrganizationsClient.builder()
                .withCredentials(new ProfileCredentialsProvider())
                .withRegion(Regions.US_EAST_1)
                .build();

            organizationsClient.registerDelegatedAdministrator(new RegisterDelegatedAdministratorRequest()
                .withAccountId(delegatedAdminAccountId)
                .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();
        }
	}
}
```