

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 License Manager 中共享自行管理的许可证
<a name="share-license-configuration"></a>

您可以使用 AWS Resource Access Manager 与任何 AWS 账户或通过 AWS Organizations任何账户共享您的自我管理许可证。有关更多信息，请参阅《*AWS RAM 用户指南》*[中的共享 AWS 资源](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html)。

## 与您的 AWS 组织共享自我管理许可证
<a name="share-license-configuration-with-org"></a>

**先决条件**  
要完成此过程，您必须将您的 AWS 组织与 License Manager 关联起来。有关更多信息，请参阅 [License Manager 中的托管许可设置](settings-managed-licenses.md)。

**共享您的许可证**  
要与您的 AWS 组织共享自我管理许可证，请执行以下步骤：

1. 打开 License Manager 控制台，网址为[https://console.aws.amazon.com/license-manager/](https://console.aws.amazon.com/license-manager/)。

1. 在左侧导航窗格中，选择**自管理许可证**。

1. 选择自管理许可证。

1. 从 “**操作**” 菜单中选择 “**与 AWS 组织帐户共享**”。

## 支持的账户配额
<a name="share-license-configuration-quotas"></a>

如果您在 2023 年 10 月 14 日 AWS License Manager 之前启用了许可证共享，则您的组织内License Manager支持的最大账户数量的配额将低于新的默认最大值。您可以通过使用下一节中提供 AWS RAM 的 API 操作来增加此配额。有关 License Manager 中默认配额的更多信息，请参阅 *AWS 一般参考 指南*中的[使用许可证的配额](https://docs.aws.amazon.com/general/latest/gr/licensemanager.html#limits_license-manager)。

### 先决条件
<a name="share-license-configuration-quotas-prerequisites"></a>

要完成以下步骤，您必须以组织管理账户中的主题身份登录并且必须拥有以下权限：
+ `ram:EnableSharingWithAwsOrganization`
+ `iam:CreateServiceLinkedRole`
+ `organizations:enableAWSServiceAccess`
+ `organizations:DescribeOrganization`

### 增加受支持的账户配额
<a name="share-license-configuration-quotas-increase"></a>

以下步骤会将 `Number of accounts per organization for License Manager`的当前配额增加到当前默认最大数量。

**增加 License Manager 的受支持账户配额**

1. 使用[https://docs.aws.amazon.com/cli/latest/reference/organizations/describe-organization.html](https://docs.aws.amazon.com/cli/latest/reference/organizations/describe-organization.html) AWS CLI 命令通过以下操作确定组织的 ARN：

   ```
   aws organizations describe-organization
   
   {
   	"Organization": {
   		"Id": "o-abcde12345",
   		"Arn": "arn:aws:organizations::111122223333:organization/o-abcde12345",
   		"FeatureSet": "ALL",
   		"MasterAccountArn": "arn:aws:organizations::111122223333:account/o-abcde12345/111122223333",
   		"MasterAccountId": "111122223333",
   		"MasterAccountEmail": "name+orgsidentifier@example.com",
   		"AvailablePolicyTypes": [
   				{
   					"Type": "SERVICE_CONTROL_POLICY",
   					"Status": "ENABLED"
   				}
   		]
   	}
   }
   ```

1. 使用[https://docs.aws.amazon.com/cli/latest/reference/ram/get-resource-shares.html](https://docs.aws.amazon.com/cli/latest/reference/ram/get-resource-shares.html) AWS CLI 命令通过以下操作确定组织的 ARN：

   ```
   aws ram  get-resource-shares --resource-owner SELF --tag-filters tagKey=Service,tagValues=LicenseManager --region {{us-east-1}}
   
   {
   	"resourceShares": [
   		{
   				"resourceShareArn": "arn:aws:ram:us-east-1:111122223333:resource-share/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
   				"name": "licenseManagerResourceShare-111122223333",
   				"owningAccountId": "111122223333",
   				"allowExternalPrincipals": true,
   				"status": "ACTIVE",
   				"tags": [
   					{
   						"key": "Service",
   						"value": "LicenseManager"
   					}
   				],
   				"creationTime": "2023-10-04T12:52:10.021000-07:00",
   				"lastUpdatedTime": "2023-10-04T12:52:10.021000-07:00",
   				"featureSet": "STANDARD"
   		}
   	]
   }
   ```

1. 使用[https://docs.aws.amazon.com/cli/latest/reference/ram/enable-sharing-with-aws-organization.html](https://docs.aws.amazon.com/cli/latest/reference/ram/enable-sharing-with-aws-organization.html) AWS CLI 命令通过以下方式启用资源共享 AWS RAM：

   ```
   aws ram enable-sharing-with-aws-organization
   
   {
   	"returnValue": true
   }
   ```

   您可以使用[https://docs.aws.amazon.com/cli/latest/reference/organizations/list-aws-service-access-for-organization.html](https://docs.aws.amazon.com/cli/latest/reference/organizations/list-aws-service-access-for-organization.html) AWS CLI 命令来验证 Organizations 列表是否已为 License Manager 启用服务主体，以及 AWS RAM：

   ```
   aws organizations list-aws-service-access-for-organization
   
   {
   	"EnabledServicePrincipals": [
   		{
   				"ServicePrincipal": "license-manager.amazonaws.com",
   				"DateEnabled": "2023-10-04T12:50:59.814000-07:00"
   		},
   		{
   				"ServicePrincipal": "license-manager.member-account.amazonaws.com",
   				"DateEnabled": "2023-10-04T12:50:59.565000-07:00"
   		},
   		{
   				"ServicePrincipal": "ram.amazonaws.com",
   				"DateEnabled": "2023-10-04T13:06:34.771000-07:00"
   		}
   	]
   }
   ```
**重要**  
 您的组织可能需要长达六个小时 AWS RAM 才能完成此操作。必须先完成此过程，然后才能继续。

1. 使用[https://docs.aws.amazon.com/cli/latest/reference/ram/associate-resource-share.html](https://docs.aws.amazon.com/cli/latest/reference/ram/associate-resource-share.html) AWS CLI 命令将您的 License Manager 资源共享与您的组织相关联：

   ```
   aws ram associate-resource-share --resource-share-arn arn:aws:ram:{{us-east-1}}:{{111122223333}}:resource-share/{{a1b2c3d4-5678-90ab-cdef-EXAMPLE11111}} --principals arn:aws:organizations::{{111122223333}}:organization/{{o-abcde12345}} --region {{us-east-1}}
   
   {
   	"resourceShareAssociations": [
   		{
   				"resourceShareArn": "arn:aws:ram:us-east-1:111122223333:resource-share/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
   				"associatedEntity": "arn:aws:organizations::111122223333:organization/o-abcde12345",
   				"associationType": "PRINCIPAL",
   				"status": "ASSOCIATING",
   				"external": false
   		}
   	]
   }
   ```

   您可以使用[https://docs.aws.amazon.com/cli/latest/reference/ram/get-resource-share-associations.html](https://docs.aws.amazon.com/cli/latest/reference/ram/get-resource-share-associations.html) AWS CLI 命令来验证资源共享关联是否`status`为`ASSOCIATED`：

   ```
   aws ram get-resource-share-associations --association-type "PRINCIPAL" --principal arn:aws:organizations::{{111122223333}}:organization/{{o-abcde12345}}--resource-share-arns arn:aws:ram:{{us-east-1}}:{{111122223333}}:resource-share/{{a1b2c3d4-5678-90ab-cdef-EXAMPLE11111}} --region {{us-east-1}}
   				
   {
   	"resourceShareAssociations": [
   		{
   				"resourceShareArn": "arn:aws:ram:us-east-1:111122223333:resource-share/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
   				"resourceShareName": "licenseManagerResourceShare-111122223333",
   				"associatedEntity": "arn:aws:organizations::111122223333:organization/o-abcde12345",
   				"associationType": "PRINCIPAL",
   				"status": "ASSOCIATED",
   				"creationTime": "2023-10-04T13:12:33.422000-07:00",
   				"lastUpdatedTime": "2023-10-04T13:12:34.663000-07:00",
   				"external": false
   		}
   	]
   }
   ```