

# 通过使用 AWS RAM 共享 S3 on Outposts
<a name="outposts-sharing-with-ram"></a>

Amazon S3 on Outposts 支持通过使用 AWS Resource Access Manager ([AWS RAM](https://docs.aws.amazon.com/ram/latest/userguide/what-is.html)) 跨一个企业内的多个账户共享 S3 容量。借助 S3 on Outposts 共享，您可以允许其他人在您的 Outpost 上创建和管理存储桶、端点和访问点。

本主题演示如何使用 AWS RAM 与您的 AWS 企业中的另一个 AWS 账户 共享 S3 on Outposts 和相关资源。

## 先决条件
<a name="outposts-ram-prereqs"></a>
+ Outpost 拥有者账户在 AWS Organizations 中配置了一个企业。有关更多信息，请参阅 *AWS Organizations 用户指南*中的[创建企业](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_create.html)。
+ 该企业包括您想与之共享 S3 on Outposts 容量的 AWS 账户。有关更多信息，请参阅 *AWS Organizations 用户指南*中的[向 AWS 账户 发送邀请](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_invites.html#orgs_manage_accounts_invite-account)。
+ 请选择要共享的以下选项之一。必须选择第二个资源（**Subnets**（子网）或 **Outposts**），以便端点也可供访问。端点是网络要求，以便访问 S3 on Outposts 中存储的数据。    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/AmazonS3/latest/s3-outposts/outposts-sharing-with-ram.html)

## 过程
<a name="outposts-ram-procedure"></a>

1. 使用拥有 Outpost 的 AWS 账户登录到 AWS 管理控制台，然后打开 AWS RAM 控制台，地址为 [https://console.aws.amazon.com/ram/home](https://console.aws.amazon.com/ram/home)。

1. 确保您已在 AWS RAM 中启用与 AWS Organizations 共享。有关更多信息，请参阅 *AWS RAM 用户指南*中的[在 AWS Organizations 中启用资源共享](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html#getting-started-sharing-orgs)。

1. 使用[先决条件](#outposts-ram-prereqs)中的选项 1 或选项 2 创建资源共享。如果您有多个 S3 on Outposts 资源，请选择要共享的资源的 Amazon 资源名称 (ARN)。要启用端点，请共享您的子网或 Outpost。

   有关如何创建资源共享的更新信息，请参阅 *AWS RAM 用户指南*中的[创建资源共享](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html#getting-started-sharing-create)。

1. 您与之共享资源的 AWS 账户 现在应该能够使用 S3 on Outposts 了。根据您在[先决条件](#outposts-ram-prereqs)中选择的选项，向账户用户提供以下信息：    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/AmazonS3/latest/s3-outposts/outposts-sharing-with-ram.html)

**注意**  
用户可以使用 AWS RAM 控制台、AWS Command Line Interface (AWS CLI)、AWS SDK 或 REST API 确认已与他们共享资源。用户可以使用 [get-resource-shares](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ram/get-resource-shares.html) CLI 命令查看他们的现有资源共享。

## 用法示例
<a name="outposts-ram-examples"></a>

在您与另一个账户共享 S3 on Outposts 资源后，该账户可以管理 Outpost 上的存储桶和对象。如果您共享了 **Subnets**（子网）资源，那么该账户可以使用您创建的端点。以下示例演示了用户如何使用 AWS CLI 在您共享这些资源后与您的 Outpost 互动。

**Example ：创建存储桶**  
以下示例在 Outpost `{{op-01ac5d28a6a232904}}` 上创建名为 {{amzn-s3-demo-bucket1}} 的存储桶。在使用此命令之前，请针对您的使用案例将每个 `{{user input placeholder}}` 替换为适合的值。  

```
aws s3control create-bucket --bucket {{{{amzn-s3-demo-bucket1}}}} --outpost-id {{op-01ac5d28a6a232904}}
```
有关此命令的更多信息，请参阅《AWS CLI 命令参考》中的 [create-bucket](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/create-bucket.html)。

**Example ：创建访问点**  
以下示例使用下表中的示例参数在 Outpost 上创建访问点。在使用此命令之前，请针对您的使用案例将这些 `{{user input placeholder}}` 值和 AWS 区域 代码替换为适合的值。  


| **参数** | **值** | 
| --- | --- | 
| 账户 ID | {{111122223333}} | 
| 访问点名称 | {{example-outpost-access-point}} | 
| Outpost ID | {{op-01ac5d28a6a232904}} | 
| Outpost 存储桶名称 | {{amzn-s3-demo-bucket1}} | 
| VPC ID | {{vpc-1a2b3c4d5e6f7g8h9}} | 
账户 ID 参数必须是存储桶拥有者的 AWS 账户 ID，即共享用户。

```
aws s3control create-access-point --account-id {{111122223333}} --name {{example-outpost-access-point}} \
--bucket arn:aws:s3-outposts:{{us-east-1}}:{{111122223333}}:outpost/{{op-01ac5d28a6a232904}}/bucket/{{{{amzn-s3-demo-bucket1}}}} \
--vpc-configuration VpcId={{vpc-1a2b3c4d5e6f7g8h9}}
```
有关此命令的更多信息，请参阅《AWS CLI 参考》中的 [create-access-point](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/create-access-point.html) 。

**Example ：上传对象**  
以下示例将通过 AWS 账户 {{`111122223333`}} 拥有的 Outpost {{`op-01ac5d28a6a232904`}} 上的访问点 {{`example-outpost-access-point`}}，将文件 {{`my_image.jpg`}} 从用户的本地文件系统上传到名为 {{`images/my_image.jpg`}} 的对象。在使用此命令之前，请针对您的使用案例将这些 `{{user input placeholder}}` 值和 AWS 区域 代码替换为适合的值。  

```
aws s3api put-object --bucket arn:aws:s3-outposts:{{us-east-1}}:{{111122223333}}:outpost/{{op-01ac5d28a6a232904}}/accesspoint/{{example-outpost-access-point}} \
--body {{my_image.jpg}} --key {{images/my_image.jpg}}
```
有关此命令的更多信息，请参阅《AWS CLI 参考》中的 [put-object](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/put-object.html)。  
如果此操作导致未找到资源错误或无响应，则您的 VPC 可能没有共享端点。  
要检查是否存在共享端点，请使用 [list-shared-endpoints](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3outposts/list-shared-endpoints.html) AWS CLI 命令。如果没有共享端点，请与 Outpost 拥有者合作创建一个。有关更多信息，请参阅《Amazon Simple Storage Service API 参考》中的 [ListSharedEndpoints](https://docs.aws.amazon.com/AmazonS3/latest/API/API_s3outposts_ListSharedEndpoints.html)。

**Example ：创建端点**  
以下示例在共享的 Outpost 上创建端点。在使用此命令之前，请针对您的使用案例将 Outpost ID、子网 ID 和安全组 ID 的 `{{user input placeholder}}` 值替换为适合的值。  
只有在资源共享中包含 **Outposts** 资源时，用户才可以执行此操作。

```
aws s3outposts create-endpoint --outposts-id {{op-01ac5d28a6a232904}} --subnet-id {{XXXXXX}} --security-group-id {{XXXXXXX}}
```
有关此命令的更多信息，请参阅《AWS CLI 参考》中的 [create-endpoint](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3outposts/create-endpoint.html)。