

要获得与亚马逊 Timestream 类似的功能 LiveAnalytics，可以考虑适用于 InfluxDB 的亚马逊 Timestream。适用于 InfluxDB 的 Amazon Timestream 提供简化的数据摄取和个位数毫秒级的查询响应时间，以实现实时分析。点击[此处](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html)了解更多信息。

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

# 适用于 Amazon Timestream 的身份和访问管理 LiveAnalytics
<a name="security-iam"></a>

AWS Identity and Access Management (IAM) AWS 服务 可帮助管理员安全地控制对 AWS 资源的访问权限。IAM 管理员控制谁可以*进行身份验证*（登录）和*授权（有权*限）使用 Timestream 获取 LiveAnalytics 资源。您可以使用 IAM AWS 服务 ，无需支付额外费用。

**Topics**
+ [受众](#security_iam_audience)
+ [使用身份进行身份验证](#security_iam_authentication)
+ [使用策略管理访问](#security_iam_access-manage)
+ [亚马逊 Timestream 版如何与 IAM 配 LiveAnalytics 合使用](security_iam_service-with-iam.md)
+ [AWS 亚马逊 Timestream Live Analytics 的托管政策](security-iam-awsmanpol.md)
+ [Amazon Timestream 查看 LiveAnalytics 基于身份的策略示例](security_iam_id-based-policy-examples.md)
+ [对 Amazon Timestream 的 LiveAnalytics 身份和访问权限进行故障排除](security_iam_troubleshoot.md)

## 受众
<a name="security_iam_audience"></a>

您的使用方式 AWS Identity and Access Management (IAM) 因您的角色而异：
+ **服务用户**：如果您无法访问功能，请从管理员处请求权限（请参阅[对 Amazon Timestream 的 LiveAnalytics 身份和访问权限进行故障排除](security_iam_troubleshoot.md)）
+ **服务管理员**：确定用户访问权限并提交权限请求（请参阅[亚马逊 Timestream 版如何与 IAM 配 LiveAnalytics 合使用](security_iam_service-with-iam.md)）
+ **IAM 管理员**：编写用于管理访问权限的策略（请参阅[Amazon Timestream 查看 LiveAnalytics 基于身份的策略示例](security_iam_id-based-policy-examples.md)）

## 使用身份进行身份验证
<a name="security_iam_authentication"></a>

身份验证是您 AWS 使用身份凭证登录的方式。您必须以 IAM 用户身份进行身份验证 AWS 账户根用户，或者通过担任 IAM 角色进行身份验证。

您可以使用来自身份源的证书 AWS IAM Identity Center （例如（IAM Identity Center）、单点登录身份验证或 Google/Facebook 证书，以联合身份登录。有关登录的更多信息，请参阅《AWS 登录 用户指南》**中的[如何登录您的 AWS 账户](https://docs.aws.amazon.com/signin/latest/userguide/how-to-sign-in.html)。

对于编程访问， AWS 提供 SDK 和 CLI 来对请求进行加密签名。有关更多信息，请参阅*《IAM 用户指南》*中的[适用于 API 请求的AWS 签名版本 4](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html)。

### IAM 用户和群组
<a name="security_iam_authentication-iamuser"></a>

*[IAM 用户](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html)*是对某个人员或应用程序具有特定权限的一个身份。建议使用临时凭证，而非具有长期凭证的 IAM 用户。有关更多信息，请参阅 *IAM 用户指南*[中的要求人类用户使用身份提供商的联合身份验证才能 AWS 使用临时证书进行访问](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#bp-users-federation-idp)。

[https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html)指定一组 IAM 用户，便于更轻松地对大量用户进行权限管理。有关更多信息，请参阅*《IAM 用户指南》*中的 [IAM 用户使用案例](https://docs.aws.amazon.com/IAM/latest/UserGuide/gs-identities-iam-users.html)。

### IAM 角色
<a name="security_iam_authentication-iamrole"></a>

*[IAM 角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)*是具有特定权限的身份，可提供临时凭证。您可以通过[从用户切换到 IAM 角色（控制台）](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html)或调用 AWS CLI 或 AWS API 操作来代入角色。有关更多信息，请参阅《IAM 用户指南》**中的[担任角色的方法](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage-assume.html)。

IAM 角色对于联合用户访问、临时 IAM 用户权限、跨账户访问、跨服务访问以及在 Amazon EC2 上运行的应用程序非常有用。有关更多信息，请参阅《IAM 用户指南》**中的 [IAM 中的跨账户资源访问](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)。

## 使用策略管理访问
<a name="security_iam_access-manage"></a>

您可以 AWS 通过创建策略并将其附加到 AWS 身份或资源来控制中的访问权限。策略定义了与身份或资源关联时的权限。 AWS 在委托人提出请求时评估这些政策。大多数策略都以 JSON 文档的 AWS 形式存储在中。有关 JSON 策略文档的更多信息，请参阅*《IAM 用户指南》*中的 [JSON 策略概述](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json)。

管理员使用策略，通过定义哪个**主体**可以在什么**条件**下对哪些**资源**执行哪些**操作**来指定谁有权访问什么。

默认情况下，用户和角色没有权限。IAM 管理员创建 IAM 策略并将其添加到角色中，然后用户可以担任这些角色。IAM 策略定义权限，与执行操作所用的方法无关。

### 基于身份的策略
<a name="security_iam_access-manage-id-based-policies"></a>

基于身份的策略是您附加到身份（用户、组或角色）的 JSON 权限策略文档。这些策略控制身份可以执行什么操作、对哪些资源执行以及在什么条件下执行。要了解如何创建基于身份的策略，请参阅《IAM 用户指南》**中的[使用客户管理型策略定义自定义 IAM 权限](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html)。

基于身份的策略可以是*内联策略*（直接嵌入到单个身份中）或*托管策略*（附加到多个身份的独立策略）。要了解如何在托管策略和内联策略之间进行选择，请参阅*《IAM 用户指南》*中的[在托管策略与内联策略之间进行选择](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-choosing-managed-or-inline.html)。

### 基于资源的策略
<a name="security_iam_access-manage-resource-based-policies"></a>

基于资源的策略是附加到资源的 JSON 策略文档。示例包括 IAM *角色信任策略*和 Amazon S3 *存储桶策略*。在支持基于资源的策略的服务中，服务管理员可以使用它们来控制对特定资源的访问。您必须在基于资源的策略中[指定主体](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html)。

基于资源的策略是位于该服务中的内联策略。您不能在基于资源的策略中使用 IAM 中的 AWS 托管策略。

### 访问控制列表 (ACLs)
<a name="security_iam_access-manage-acl"></a>

访问控制列表 (ACLs) 控制哪些委托人（账户成员、用户或角色）有权访问资源。 ACLs 与基于资源的策略类似，尽管它们不使用 JSON 策略文档格式。

Amazon S3 和 Amazon VPC 就是支持的服务示例 ACLs。 AWS WAF要了解更多信息 ACLs，请参阅《*亚马逊简单存储服务开发者指南*》中的[访问控制列表 (ACL) 概述](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html)。

### 其他策略类型
<a name="security_iam_access-manage-other-policies"></a>

AWS 支持其他策略类型，这些策略类型可以设置更常见的策略类型授予的最大权限：
+ **权限边界** – 设置基于身份的策略可以授予 IAM 实体的最大权限。有关更多信息，请参阅《 IAM 用户指南》**中的 [IAM 实体的权限边界](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html)。
+ **服务控制策略 (SCPs)**-在中指定组织或组织单位的最大权限 AWS Organizations。有关更多信息，请参阅《AWS Organizations 用户指南》**中的[服务控制策略](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html)。
+ **资源控制策略 (RCPs)**-设置账户中资源的最大可用权限。有关更多信息，请参阅《*AWS Organizations 用户指南》*中的[资源控制策略 (RCPs)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html)。
+ **会话策略** – 在为角色或联合用户创建临时会话时，作为参数传递的高级策略。有关更多信息，请参阅《IAM 用户指南》**中的[会话策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)。

### 多个策略类型
<a name="security_iam_access-manage-multiple-policies"></a>

当多个类型的策略应用于一个请求时，生成的权限更加复杂和难以理解。要了解在涉及多种策略类型时如何 AWS 确定是否允许请求，请参阅 *IAM 用户指南*中的[策略评估逻辑](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html)。

# 亚马逊 Timestream 版如何与 IAM 配 LiveAnalytics 合使用
<a name="security_iam_service-with-iam"></a>

在使用 IAM 管理对 Timestream 的访问权限之前 LiveAnalytics，您应该了解 Timestream 有哪些可用的 IAM 功能。 LiveAnalytics要全面了解 Timestream LiveAnalytics 和其他 AWS 服务如何与 IAM 配合使用，请参阅 IAM *用户指南*中的[与 IAM 配合使用的AWS 服务](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)。

**Topics**
+ [LiveAnalytics 基于身份的策略的时间流](#security_iam_service-with-iam-id-based-policies)
+ [基于 LiveAnalytics 资源的策略的时间流](#security_iam_service-with-iam-resource-based-policies)
+ [基于时间流对标签进行 LiveAnalytics 授权](#security_iam_service-with-iam-tags)
+ [LiveAnalytics IAM 角色的时间流](#security_iam_service-with-iam-roles)

## LiveAnalytics 基于身份的策略的时间流
<a name="security_iam_service-with-iam-id-based-policies"></a>

通过使用 IAM 基于身份的策略，您可以指定允许或拒绝的操作和资源以及允许或拒绝操作的条件。Timestream LiveAnalytics 支持特定的操作和资源以及条件键。要了解在 JSON 策略中使用的所有元素，请参阅《IAM 用户指南》** 中的 [IAM JSON 策略元素参考](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html)。

### 操作
<a name="security_iam_service-with-iam-id-based-policies-actions"></a>

管理员可以使用 AWS JSON 策略来指定谁有权访问什么。也就是说，哪个**主体**可以对什么**资源**执行**操作**，以及在什么**条件**下执行。

JSON 策略的 `Action` 元素描述可用于在策略中允许或拒绝访问的操作。在策略中包含操作以授予执行关联操作的权限。

 您可以在 IAM 策略语句的 Action 元素中指定以下操作。可以使用策略授予在 AWS中执行操作的权限。您在策略中使用一项操作时，通常使用相同的名称允许或拒绝对 API 操作、CLI 命令或 SQL 命令的访问。

 在某些情况下，单个动作即可控制对 API 操作和 SQL 命令的访问。还有某些操作需要多种不同的动作。

有关支持的 Timestream LiveAnalytics `Action` 的列表，请参阅下表：

**注意**  
对于所有特定于数据库的 `Actions`，您可以指定数据库 ARN，以限制对特定数据库的操作。


| 操作 | 描述 | 访问级别 | 资源类型（\$1 为必需） | 
| --- | --- | --- | --- | 
|  DescribeEndpoints  |  返回必须向其发送后续请求的 Timestream 端点。  |  全部  |  \$1  | 
|  Select  |  在 Timestream 上运行查询，从一个或多个表中选择数据。[请参阅此说明以获取详细说明](#security_iam_service-with-iam-id-based-policies-actions.select-vs-selectvalues)  |  读取  |  表\$1  | 
|  CancelQuery  |  取消查询。  |  读取  |  \$1  | 
|  ListTables  |  获取表列表。  |  列表  |  数据库\$1  | 
|  ListDatabases  |  获取数据库列表。  |  列表  |  \$1  | 
|  ListMeasures  |  获取度量列表。  |  读取  |  表\$1  | 
|  DescribeTable  |  获取表描述。  |  读取  |  表\$1  | 
|  DescribeDatabase  |  获取数据库描述。  |  读取  |  数据库\$1  | 
|  SelectValues  |  运行无需指定特定资源的查询。[请参阅此说明以获取详细说明](#security_iam_service-with-iam-id-based-policies-actions.select-vs-selectvalues)。  |  读取  |  \$1  | 
|  WriteRecords  |  将数据插入到 Timestrea 中。  |  写入  |  表\$1  | 
|  CreateTable  |  创建表。  |  写入  |  数据库\$1  | 
|  CreateDatabase  |  创建数据库。  |  写入  |  \$1  | 
|  DeleteDatabase  |  删除数据库。  |  写入  |  \$1  | 
|  UpdateDatabase  |  更新数据库。  |  写入  |  \$1  | 
|  DeleteTable  |  删除表。  |  写入  |  数据库\$1  | 
|  UpdateTable  |  更新表。  |  写入  |  数据库\$1  | 

#### SelectValues 与选择：
<a name="security_iam_service-with-iam-id-based-policies-actions.select-vs-selectvalues"></a>

`SelectValues` 是 用于查询的 `Action`，该查询*不*需要资源。不需要资源的查询示例如下所示：

```
SELECT 1
```

请注意，此查询并未引用特定的时间流来获取 LiveAnalytics 资源。再举一个例子：

```
SELECT now()
```

此查询使用`now()`函数返回当前时间戳，但不需要指定资源。 `SelectValues`通常用于测试，因此 Timestream for LiveAnalytics 可以在没有资源的情况下运行查询。现在，考虑 `Select` 查询：

```
SELECT * FROM database.table
```

这种类型的查询需要资源，特别是用于的 Timestream LiveAnalytics `table`，以便可以从表中获取指定的数据。

### 资源
<a name="security_iam_service-with-iam-id-based-policies-resources"></a>

管理员可以使用 AWS JSON 策略来指定谁有权访问什么。也就是说，哪个**主体**可以对什么**资源**执行**操作**，以及在什么**条件**下执行。

`Resource` JSON 策略元素指定要向其应用操作的一个或多个对象。作为最佳实践，请使用其 [Amazon 资源名称（ARN）](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html)指定资源。对于不支持资源级权限的操作，请使用通配符 (\$1) 指示语句应用于所有资源。

```
"Resource": "*"
```

在 Timestream 中，可以在 IAM 权限的`Resource`元素中使用 LiveAnalytics 数据库和表。

 LiveAnalytics 数据库资源的时间流具有以下 ARN：

```
arn:${Partition}:timestream:${Region}:${Account}:database/${DatabaseName}
```

 LiveAnalytics 表格资源的时间流具有以下 ARN：

```
arn:${Partition}:timestream:${Region}:${Account}:database/${DatabaseName}/table/${TableName}
```

有关格式的更多信息 ARNs，请参阅 [Amazon 资源名称 (ARNs) 和 AWS 服务命名空间](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)。

例如，要在语句中指定 `database` 键空间，请使用以下 ARN：

```
"Resource": "arn:aws:timestream:us-east-1:123456789012:database/mydatabase"
```

要指定属于特定账户的所有数据库，请使用通配符（\$1）：

```
"Resource": "arn:aws:timestream:us-east-1:123456789012:database/*"
```

某些用于 LiveAnalytics 操作的时间流（例如创建资源的操作）无法在特定资源上执行。在这些情况下，您必须使用通配符（\$1)。

```
"Resource": "*"
```

### 条件键
<a name="security_iam_service-with-iam-id-based-policies-conditionkeys"></a>

Timestream for LiveAnalytics 不提供任何特定于服务的条件密钥，但它确实支持使用一些全局条件密钥。要查看所有 AWS 全局条件键，请参阅 *IAM 用户指南*中的[AWS 全局条件上下文密钥](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。

### 示例
<a name="security_iam_service-with-iam-id-based-policies-examples"></a>

要查看 LiveAnalytics 基于身份的策略的 Timestream 示例，请参阅。[Amazon Timestream 查看 LiveAnalytics 基于身份的策略示例](security_iam_id-based-policy-examples.md)

## 基于 LiveAnalytics 资源的策略的时间流
<a name="security_iam_service-with-iam-resource-based-policies"></a>

的 Timestream LiveAnalytics 不支持基于资源的策略。要查看详细的基于资源的策略页面示例，请参阅 [https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html](https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html)。

## 基于时间流对标签进行 LiveAnalytics 授权
<a name="security_iam_service-with-iam-tags"></a>

您可以使用标签管理对您的 Timestream LiveAnalytics 资源的访问权限。要管理基于标签的资源访问，您可以使用 `timestream:ResourceTag/key-name`、`aws:RequestTag/key-name` 或 `aws:TagKeys` 条件键在策略的[条件元素](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)中提供标签信息。有关为 LiveAnalytics 资源标记 Timestream 的更多信息，请参阅。[向资源添加标签和标注](tagging-keyspaces.md)

要查看基于身份的策略（用于根据资源上的标签来限制对该资源的访问）的示例，请参阅[基于标签的 LiveAnalytics 资源访问时间流](security_iam_id-based-policy-examples.md#security_iam_id-based-policy-examples-tags)。

## LiveAnalytics IAM 角色的时间流
<a name="security_iam_service-with-iam-roles"></a>

I [AM 角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)是您的 AWS 账户中具有特定权限的实体。

### 将临时凭证与 Timestream 配合使用 LiveAnalytics
<a name="security_iam_service-with-iam-roles-tempcreds"></a>

可以使用临时凭证进行联合身份验证登录，分派 IAM 角色或分派跨账户角色。您可以通过调用[AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html)或之类的 AWS STS API 操作来获取临时安全证书[GetFederationToken](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html)。

### 服务关联角色
<a name="security_iam_service-with-iam-roles-service-linked"></a>

的 Timestream LiveAnalytics 不支持服务相关角色。

### 服务角色
<a name="security_iam_service-with-iam-roles-service"></a>

的时间流 LiveAnalytics 不支持服务角色。

# AWS 亚马逊 Timestream Live Analytics 的托管政策
<a name="security-iam-awsmanpol"></a>







 AWS 托管策略是由创建和管理的独立策略 AWS。 AWS 托管策略旨在为许多常见用例提供权限，以便您可以开始为用户、组和角色分配权限。

请记住， AWS 托管策略可能不会为您的特定用例授予最低权限权限，因为它们可供所有 AWS 客户使用。我们建议通过定义特定于使用案例的[客户管理型策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#customer-managed-policies)来进一步减少权限。

您无法更改 AWS 托管策略中定义的权限。如果 AWS 更新 AWS 托管策略中定义的权限，则更新会影响该策略所关联的所有委托人身份（用户、组和角色）。 AWS 最有可能在启动新的 API 或现有服务可以使用新 AWS 服务 的 API 操作时更新 AWS 托管策略。

有关更多信息，请参阅《IAM 用户指南》**中的 [AWS 托管式策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)。

**Topics**
+ [AmazonTimestreamInfluxDBFull访问权限](#security-iam-awsmanpol-AmazonTimestreamInfluxDBFullAccess)
+ [AmazonTimestreamReadOnlyAccess](#security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess)
+ [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess)
+ [AmazonTimestreamFullAccess](#security-iam-awsmanpol-AmazonTimestreamFullAccess)
+ [策略更新](#security-iam-awsmanpol-updates)









## AWS 托管策略： AmazonTimestreamInfluxDBFull访问权限
<a name="security-iam-awsmanpol-AmazonTimestreamInfluxDBFullAccess"></a>

您可以将 `AmazonTimestreamInfluxDBFullAccess` 附加到您的用户、组和角色。创建、更新、删除和列出 Amazon Timestream InfluxDB 实例的策略访问权限。

**权限详细信息**  
此策略包含以下权限：
+ `Amazon Timestream`：提供完全管理访问权限以创建、更新、删除和列出 Amazon Timestream InfluxDB 实例以及创建和列出参数组。

要查看 JSON 格式的此政策，请参阅[AmazonTimestreamInfluxDBFull访问权限](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonTimestreamInfluxDBFullAccess.html)。

## AWS 托管策略： AmazonTimestreamReadOnlyAccess
<a name="security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess"></a>





您可以将 `AmazonTimestreamReadOnlyAccess` 附加到您的用户、组和角色。策略提供对 Amazon Timestream 的只读访问权限。

**权限详细信息**  
此策略包含以下权限：
+ `Amazon Timestream`：提供对 Amazon Timestream 的只读访问权限。该策略还提供取消任何正在运行的查询的权限。

要查看 JSON 格式的此政策，请参阅[AmazonTimestreamReadOnlyAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonTimestreamReadOnlyAccess.html)。

## AWS 托管策略： AmazonTimestreamConsoleFullAccess
<a name="security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess"></a>





您可以将 `AmazonTimestreamConsoleFullAccess` 附加到您的用户、组和角色。

该策略提供使用 AWS 管理控制台管理 Amazon Timestream 的完全访问权限。此策略还授予某些 AWS KMS 操作和操作的权限，以管理您保存的查询。

**权限详细信息**  
该策略包含以下权限：
+ `Amazon Timestream`：授予主体完全访问 Amazon Timestream 的权限。
+ `AWS KMS`：允许主体列出别名和描述密钥。
+ `Amazon S3`：允许主体列出所有 Amazon S3 存储桶。
+ `Amazon SNS`：允许主体列出 Amazon SNS 主题。
+ `IAM`：允许主体列出 IAM 角色。
+ `DBQMS`：允许主体访问、创建、删除、描述和更新查询。Database Query Metadata Service（dbqms）是一项仅限内部使用的服务。它为包括Amazon Timestream在内的多个 AWS 服务（包括Amazon Timestrea AWS 管理控制台 m）上的查询编辑器提供了你最近和保存的查询。
+ `Pricing`：允许主体在创建期间访问 InfluxDB 资源配置的定价估算。
+ `Marketplace`：允许主体访问市场资源，并创建包含只读副本创建功能的 InfluxDB 集群协议。

要查看 JSON 格式的此政策，请参阅[AmazonTimestreamConsoleFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonTimestreamConsoleFullAccess.html)。

## AWS 托管策略： AmazonTimestreamFullAccess
<a name="security-iam-awsmanpol-AmazonTimestreamFullAccess"></a>





您可以将 `AmazonTimestreamFullAccess` 附加到您的用户、组和角色。

此策略提供对 Amazon Timestream 的完全访问权限。此策略还授予某些 AWS KMS 操作的权限。

**权限详细信息**  
该策略包含以下权限：
+ `Amazon Timestream`：授予主体完全访问 Amazon Timestream 的权限。
+ `AWS KMS`：允许主体列出别名和描述密钥。
+ `Amazon S3`：允许主体列出所有 Amazon S3 存储桶。

要查看 JSON 格式的此政策，请参阅[AmazonTimestreamFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonTimestreamFullAccess.html)。

## Timestream 实时分析对 AWS 托管策略的更新
<a name="security-iam-awsmanpol-updates"></a>



查看有关Timestream Live Analytics AWS 托管策略自该服务开始跟踪这些更改以来这些更新的详细信息。有关此页面更改的自动警报，请订阅 [Timestream LiveAnalytics 文档历史记录](doc-history.md)页面上的 RSS 源。




| 更改 | 描述 | 日期 | 
| --- | --- | --- | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess)：对现有策略的更新  |  适用于 InfluxDB 的 Timestream 已将 Influx Enterprise Marketplace 产品 ID 添加至现有 `AmazonTimestreamInfluxDBFullAccess` 托管策略中，以支持订阅 Enterprise Marketplace 产品。这些权限仅限于特定的 AWS Marketplace 商品，其条件是将访问权限限制为某些商品`ProductIds`。参见[AmazonTimestreamInfluxDBFull访问权限](https://docs.aws.amazon.com/timestream/latest/developerguide/security-iam-awsmanpol-influxdb.html#iam.identitybasedpolicies.predefinedpolicies)。  | 2025 年 10 月 17 日 | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess)：对现有策略的更新  |  在现有`AmazonTimestreamConsoleFullAccess`托管策略中添加了 AWS Marketplace 权限，用于访问市场资源并为创建只读副本的 InfluxDB 集群创建协议。 Timestream LiveAnalytics 还通过添加 `Sid` 字段更新了此托管政策。 策略更新不会影响 `AmazonTimestreamConsoleFullAccess` 托管策略的使用。  | 2025 年 8 月 20 日 | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess)：对现有策略的更新  |  已将 `pricing:GetProducts` 操作添加至现有 `AmazonTimestreamConsoleFullAccess` 托管策略中，以在创建期间为 InfluxDB 资源配置提供定价估算。 策略更新不会影响 `AmazonTimestreamConsoleFullAccess` 托管策略的使用。  | 2025 年 6 月 10 日 | 
|  [AmazonTimestreamReadOnlyAccess](#security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess)：对现有策略的更新  |  向现有 `AmazonTimestreamReadOnlyAccess` 托管策略添加了 `timestream:DescribeAccountSettings` 操作。此操作用于描述 AWS 账户 设置。 Timestream LiveAnalytics 还通过添加 `Sid` 字段更新了此托管政策。 策略更新不会影响 `AmazonTimestreamReadOnlyAccess` 托管策略的使用。  | 2024 年 6 月 3 日 | 
|  [AmazonTimestreamReadOnlyAccess](#security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess)：对现有策略的更新  |  向现有 `AmazonTimestreamReadOnlyAccess` 托管策略添加了 `timestream:DescribeBatchLoadTask` 和 `timestream:ListBatchLoadTasks` 操作。这些操作用于列出和描述批量加载任务。 策略更新不会影响 `AmazonTimestreamReadOnlyAccess` 托管策略的使用。  | 2023 年 2 月 24 日 | 
|  [AmazonTimestreamReadOnlyAccess](#security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess)：对现有策略的更新  |  向现有 `AmazonTimestreamReadOnlyAccess` 托管策略添加了 `timestream:DescribeScheduledQuery` 和 `timestream:ListScheduledQueries` 操作。这些操作用于列出和描述现有的计划查询。 策略更新不会影响 `AmazonTimestreamReadOnlyAccess` 托管策略的使用。  | 2021 年 11 月 29 日 | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess)：对现有策略的更新  |  向现有 `AmazonTimestreamConsoleFullAccess` 托管策略添加了 `s3:ListAllMyBuckets` 操作。此操作用于指定 Amazon S3 存储桶，以便 Timestream 记录磁性存储写入错误。 策略更新不会影响 `AmazonTimestreamConsoleFullAccess` 托管策略的使用。  | 2021 年 11 月 29 日 | 
|  [AmazonTimestreamFullAccess](#security-iam-awsmanpol-AmazonTimestreamFullAccess)：对现有策略的更新  |  向现有 `AmazonTimestreamFullAccess` 托管策略添加了 `s3:ListAllMyBuckets` 操作。此操作用于指定 Amazon S3 存储桶，以便 Timestream 记录磁性存储写入错误。 策略更新不会影响 `AmazonTimestreamFullAccess` 托管策略的使用。  | 2021 年 11 月 29 日 | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess)：对现有策略的更新  |  从现有 `AmazonTimestreamConsoleFullAccess` 托管策略中删除了冗余操作。以前，该策略包括冗余操作 `dbqms:DescribeQueryHistory`。更新的策略删除了冗余操作。 策略更新不会影响 `AmazonTimestreamConsoleFullAccess` 托管策略的使用。  | 2021 年 4 月 23 日 | 
|  Timestream LiveAnalytics 已开始跟踪更改  |  Timestream Live Analytics 开始跟踪其 AWS 托管策略的变化。  | 2021 年 4 月 21 日 | 

# Amazon Timestream 查看 LiveAnalytics 基于身份的策略示例
<a name="security_iam_id-based-policy-examples"></a>

默认情况下，IAM 用户和角色无权为 LiveAnalytics 资源创建或修改 Timestream。他们也无法使用 AWS 管理控制台、CQLSH 或 AWS API 执行任务。 AWS CLI IAM 管理员必须创建 IAM 策略，以便为用户和角色授予权限以对所需的指定资源执行特定的 API 操作。然后，管理员必须将这些策略附加到需要这些权限的 IAM 用户或组。

要了解如何使用这些示例 JSON 策略文档创建 IAM 基于身份的策略，请参阅*《IAM 用户指南》*中的 [在 JSON 选项卡上创建策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html#access_policies_create-json-editor)。

**Topics**
+ [策略最佳实践](#security_iam_service-with-iam-policy-best-practices)
+ [使用控制台的 Timestrea LiveAnalytics m](#security_iam_id-based-policy-examples-console)
+ [允许用户查看他们自己的权限](#security_iam_id-based-policy-examples-view-own-permissions)
+ [Timestream 中的常见操作 LiveAnalytics](#security_iam_id-based-policy-examples-common-operations)
+ [基于标签的 LiveAnalytics 资源访问时间流](#security_iam_id-based-policy-examples-tags)
+ [计划查询](#security_iam_id-based-policy-examples-sheduledqueries)

## 策略最佳实践
<a name="security_iam_service-with-iam-policy-best-practices"></a>

基于身份的策略决定了某人是否可以创建、访问或删除您账户中的 LiveAnalytics 资源的 Timestream。这些操作可能会使 AWS 账户产生成本。创建或编辑基于身份的策略时，请遵循以下指南和建议：
+ **开始使用 AWS 托管策略并转向最低权限权限** — 要开始向用户和工作负载授予权限，请使用为许多常见用例授予权限的*AWS 托管策略*。它们在你的版本中可用 AWS 账户。我们建议您通过定义针对您的用例的 AWS 客户托管策略来进一步减少权限。有关更多信息，请参阅《IAM 用户指南》**中的 [AWS 托管策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)或[工作职能的AWS 托管策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html)。
+ **应用最低权限**：在使用 IAM 策略设置权限时，请仅授予执行任务所需的权限。为此，您可以定义在特定条件下可以对特定资源执行的操作，也称为*最低权限许可*。有关使用 IAM 应用权限的更多信息，请参阅《IAM 用户指南》**中的 [IAM 中的策略和权限](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)。
+ **使用 IAM 策略中的条件进一步限制访问权限**：您可以向策略添加条件来限制对操作和资源的访问。例如，您可以编写策略条件来指定必须使用 SSL 发送所有请求。如果服务操作是通过特定的方式使用的，则也可以使用条件来授予对服务操作的访问权限 AWS 服务，例如 CloudFormation。有关更多信息，请参阅《IAM 用户指南》**中的 [IAM JSON 策略元素：条件](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)。
+ **使用 IAM Access Analyzer 验证您的 IAM 策略，以确保权限的安全性和功能性**：IAM Access Analyzer 会验证新策略和现有策略，以确保策略符合 IAM 策略语言（JSON）和 IAM 最佳实践。IAM Access Analyzer 提供 100 多项策略检查和可操作的建议，以帮助您制定安全且功能性强的策略。有关更多信息，请参阅《IAM 用户指南》**中的[使用 IAM Access Analyzer 验证策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-validation.html)。
+ **需要多重身份验证 (MFA**)-如果 AWS 账户您的场景需要 IAM 用户或根用户，请启用 MFA 以提高安全性。若要在调用 API 操作时需要 MFA，请将 MFA 条件添加到您的策略中。有关更多信息，请参阅《IAM 用户指南》**中的[使用 MFA 保护 API 访问](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html)。

有关 IAM 中的最佳实操的更多信息，请参阅《IAM 用户指南》**中的 [IAM 中的安全最佳实践](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)。

## 使用控制台的 Timestrea LiveAnalytics m
<a name="security_iam_id-based-policy-examples-console"></a>

Timestream LiveAnalytics 版不需要特定权限即可访问适用于控制台的 Amazon Timestream LiveAnalytics 。您至少需要具有只读权限才能列出和查看有关您 AWS 账户中 LiveAnalytics 资源的时间流的详细信息。如果您创建的基于身份的策略比所需的最低权限更严格，则无法为具有该策略的实体（IAM 用户或角色）正常运行控制台。

## 允许用户查看他们自己的权限
<a name="security_iam_id-based-policy-examples-view-own-permissions"></a>

该示例说明了您如何创建策略，以允许 IAM 用户查看附加到其用户身份的内联和托管式策略。此策略包括在控制台上或使用 AWS CLI 或 AWS API 以编程方式完成此操作的权限。

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ViewOwnUserInfo",
            "Effect": "Allow",
            "Action": [
                "iam:GetUserPolicy",
                "iam:ListGroupsForUser",
                "iam:ListAttachedUserPolicies",
                "iam:ListUserPolicies",
                "iam:GetUser"
            ],
            "Resource": ["arn:aws:iam::*:user/${aws:username}"]
        },
        {
            "Sid": "NavigateInConsole",
            "Effect": "Allow",
            "Action": [
                "iam:GetGroupPolicy",
                "iam:GetPolicyVersion",
                "iam:GetPolicy",
                "iam:ListAttachedGroupPolicies",
                "iam:ListGroupPolicies",
                "iam:ListPolicyVersions",
                "iam:ListPolicies",
                "iam:ListUsers"
            ],
            "Resource": "*"
        }
    ]
}
```

## Timestream 中的常见操作 LiveAnalytics
<a name="security_iam_id-based-policy-examples-common-operations"></a>

以下是允许在 Timestream 中进行常见操作的 IAM 策略示例 LiveAnalytics。

**Topics**
+ [允许所有操作](#security_iam_id-based-policy-examples-common-operations.all)
+ [允许 SELECT 操作](#security_iam_id-based-policy-examples-common-operations.select)
+ [允许对多个资源进行 SELECT 操作](#security_iam_id-based-policy-examples-common-operations.select-multiple-resources)
+ [允许元数据操作](#security_iam_id-based-policy-examples-common-operations.metadata)
+ [允许 INSERT 操作](#security_iam_id-based-policy-examples-common-operations.insert)
+ [允许 CRUD 操作](#security_iam_id-based-policy-examples-common-operations.crud)
+ [在没有指定资源的情况下取消查询并选择数据](#security_iam_id-based-policy-examples-common-operations.cancel-selectvalues)
+ [创建、描述、删除和描述数据库](#security_iam_id-based-policy-examples-common-operations.cddd)
+ [按标签 `{"Owner": "${username}"}` 限制列出的数据库](#security_iam_id-based-policy-examples-common-operations.list-by-tag)
+ [列出数据库中的所有表](#security_iam_id-based-policy-examples-common-operations.list-all-tables)
+ [在表上创建、描述、删除、更新和选择](#security_iam_id-based-policy-examples-common-operations.cddus-table)
+ [按表限制查询](#security_iam_id-based-policy-examples-common-operations.limit-query-table)

### 允许所有操作
<a name="security_iam_id-based-policy-examples-common-operations.all"></a>

以下是允许在 Timestream 中进行所有操作的示例策略。 LiveAnalytics

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:*"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 允许 SELECT 操作
<a name="security_iam_id-based-policy-examples-common-operations.select"></a>

以下示例策略允许对特定资源执行 `SELECT` 风格的查询。

**注意**  
将 `<account_ID>` 替换为您的 Amazon 账户 ID。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:Select",
                "timestream:DescribeTable",
                "timestream:ListMeasures"
            ],
            "Resource": "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/table/DevOps"
        },
        {
            "Effect": "Allow",
            "Action": [
                "timestream:DescribeEndpoints",
                "timestream:SelectValues",
                "timestream:CancelQuery"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 允许对多个资源进行 SELECT 操作
<a name="security_iam_id-based-policy-examples-common-operations.select-multiple-resources"></a>

以下示例策略允许对多个资源执行 `SELECT` 风格的查询。

**注意**  
将 `<account_ID>` 替换为您的 Amazon 账户 ID。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:Select",
                "timestream:DescribeTable",
                "timestream:ListMeasures"
            ],
            "Resource": [
                "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/table/DevOps",
                "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/table/DevOps1",
                "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/table/DevOps2"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "timestream:DescribeEndpoints",
                "timestream:SelectValues",
                "timestream:CancelQuery"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 允许元数据操作
<a name="security_iam_id-based-policy-examples-common-operations.metadata"></a>

以下示例策略允许用户执行元数据查询，但不允许用户执行在 Timestream 中读取或写入实际数据的操作。 LiveAnalytics

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:DescribeEndpoints",
                "timestream:DescribeTable",
                "timestream:ListMeasures",
                "timestream:SelectValues",
                "timestream:ListTables",
                "timestream:ListDatabases",
                "timestream:CancelQuery"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 允许 INSERT 操作
<a name="security_iam_id-based-policy-examples-common-operations.insert"></a>

以下示例策略允许用户对账户 `<account_id>` 内的 `database/sampleDB/table/DevOps` 执行 `INSERT` 操作。

**注意**  
将 `<account_ID>` 替换为您的 Amazon 账户 ID。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "timestream:WriteRecords"
            ],
            "Resource": [
                "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/table/DevOps"
            ],
            "Effect": "Allow"
        },
        {
            "Action": [
                "timestream:DescribeEndpoints"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}
```

------

### 允许 CRUD 操作
<a name="security_iam_id-based-policy-examples-common-operations.crud"></a>

以下示例策略允许用户在 Timestream 中为执行 CRUD 操作。 LiveAnalytics

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:DescribeEndpoints",
                "timestream:CreateTable",
                "timestream:DescribeTable",
                "timestream:CreateDatabase",
                "timestream:DescribeDatabase",
                "timestream:ListTables",
                "timestream:ListDatabases",
                "timestream:DeleteTable",
                "timestream:DeleteDatabase",
                "timestream:UpdateTable",
                "timestream:UpdateDatabase"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 在没有指定资源的情况下取消查询并选择数据
<a name="security_iam_id-based-policy-examples-common-operations.cancel-selectvalues"></a>

以下示例策略允许用户取消查询并对不需要指定资源的数据执行 `Select` 查询：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:SelectValues",
                "timestream:CancelQuery"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 创建、描述、删除和描述数据库
<a name="security_iam_id-based-policy-examples-common-operations.cddd"></a>

以下示例策略允许用户创建、描述、删除和描述数据库 `sampleDB`：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:CreateDatabase",
                "timestream:DescribeDatabase",
                "timestream:DeleteDatabase",
                "timestream:UpdateDatabase"
            ],
            "Resource": "arn:aws:timestream:us-east-1:111122223333:database/sampleDB"
        }
    ]
}
```

------

### 按标签 `{"Owner": "${username}"}` 限制列出的数据库
<a name="security_iam_id-based-policy-examples-common-operations.list-by-tag"></a>

以下策略示例允许用户列出所有标有键值对 `{"Owner": "${username}"}` 的数据库：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:ListDatabases"
            ],
            "Resource": "arn:aws:timestream:us-east-1:111122223333:database/*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/Owner": "${aws:username}"
                }
            }
        }
    ]
}
```

------

### 列出数据库中的所有表
<a name="security_iam_id-based-policy-examples-common-operations.list-all-tables"></a>

以下示例策略用于列出数据库 `sampleDB` 中的所有表：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:ListTables"
            ],
            "Resource": "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/"
        }
    ]
}
```

------

### 在表上创建、描述、删除、更新和选择
<a name="security_iam_id-based-policy-examples-common-operations.cddus-table"></a>

以下示例策略允许用户创建表、描述表、删除表、更新表以及对数据库 `sampleDB` 中的表 `DevOps` 执行 `Select` 查询：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:CreateTable",
                "timestream:DescribeTable",
                "timestream:DeleteTable",
                "timestream:UpdateTable",
                "timestream:Select"
            ],
            "Resource": "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/table/DevOps"
        }
    ]
}
```

------

### 按表限制查询
<a name="security_iam_id-based-policy-examples-common-operations.limit-query-table"></a>

以下示例策略允许用户查询数据库 `DevOps` 中除 `sampleDB` 之外的所有表：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:Select"
            ],
            "Resource": "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/table/*"
        },
        {
            "Effect": "Deny",
            "Action": [
                "timestream:Select"
            ],
            "Resource": "arn:aws:timestream:us-east-1:111122223333:database/sampleDB/table/DevOps"
        }
    ]
}
```

------

## 基于标签的 LiveAnalytics 资源访问时间流
<a name="security_iam_id-based-policy-examples-tags"></a>

您可以使用基于身份的策略中的条件来控制基于标签的 LiveAnalytics 资源对 Timestream 的访问权限。本章节提供了一些示例。

以下示例说明如何创建一个策略，该策略授予用户查看表的权限（如果表的 `Owner` 包含该用户的用户名的值）。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ReadOnlyAccessTaggedTables",
            "Effect": "Allow",
            "Action": "timestream:Select",
            "Resource": "arn:aws:timestream:us-east-2:111122223333:database/mydatabase/table/*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/Owner": "${aws:username}"
                }
            }
        }
    ]
}
```

------

您可以将该策略附加到您账户中的 IAM 用户。如果名为的用户`richard-roe`尝试查看 LiveAnalytics 表的时间流，则必须对该表进行标记`Owner=richard-roe`或`owner=richard-roe`。否则，他将被拒绝访问。条件标签键 `Owner` 匹配 `Owner` 和 `owner`，因为条件键名称不区分大小写。有关更多信息，请参阅 *IAM 用户指南* 中的 [IAM JSON 策略元素：条件](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)。

如果请求中传递的标签具有键 `Owner` 和值 `username`，则以下策略授予用户创建带标签的表的权限：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "CreateTagTableUser",
            "Effect": "Allow",
            "Action": [
                "timestream:CreateTable",
                "timestream:TagResource"
            ],
            "Resource": "arn:aws:timestream:us-east-2:111122223333:database/mydatabase/table/*",
            "Condition": {
                "ForAnyValue:StringEquals": {
                    "aws:RequestTag/Owner": "${aws:username}"
                }
            }
        }
    ]
}
```

------

以下策略允许在 `env` 标签设置为 `dev` 或 `test` 的任何数据库上使用 `DescribeDatabase` API：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowDescribe",
            "Effect": "Allow",
            "Action": [
                "timestream:DescribeEndpoints",
                "timestream:DescribeDatabase"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AllowTagAccessForDevResources",
            "Effect": "Allow",
            "Action": [
                "timestream:TagResource"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "aws:RequestTag/env": [
                        "test",
                        "dev"
                    ]
                }
            }
        }
    ]
}
```

------

此策略使用 `Condition` 键来允许将键 `env` 且值为 `test`、`qa` 或 `dev` 的标签添加到资源中。

## 计划查询
<a name="security_iam_id-based-policy-examples-sheduledqueries"></a>

### 列出、删除、更新、执行 ScheduledQuery
<a name="security_iam_id-based-policy-examples-sheduledqueries-alloperations"></a>

以下策略示例允许用户列出、删除、更新和执行计划查询。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "timestream:DeleteScheduledQuery",
                "timestream:ExecuteScheduledQuery",
                "timestream:UpdateScheduledQuery",
                "timestream:ListScheduledQueries",
                "timestream:DescribeEndpoints"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### CreateScheduledQuery 使用客户管理的 KMS 密钥
<a name="security_iam_id-based-policy-examples-sheduledqueries-create"></a>

以下示例策略允许用户创建使用客户托管的 KMS 密钥加密的计划查询; *<keyid for ScheduledQuery>*。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "iam:PassRole"
            ],
            "Resource": [
                "arn:aws:iam::123456789012:role/ScheduledQueryExecutionRole"
            ],
            "Effect": "Allow"
        },
        {
            "Action": [
                "timestream:CreateScheduledQuery",
                "timestream:DescribeEndpoints"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "kms:DescribeKey",
                "kms:GenerateDataKey"
            ],
            "Resource": "arn:aws:kms:us-west-2:123456789012:key/<keyid for ScheduledQuery>",
            "Effect": "Allow"
        }
    ]
}
```

------

### DescribeScheduledQuery 使用客户管理的 KMS 密钥
<a name="security_iam_id-based-policy-examples-sheduledqueries-describe"></a>

以下示例策略允许用户描述使用客户托管的 KMS 密钥创建的计划查询; *<keyid for ScheduledQuery>*。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "timestream:DescribeScheduledQuery",
                "timestream:DescribeEndpoints"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "kms:Decrypt"
            ],
            "Resource": "arn:aws:kms:us-west-2:123456789012:key/<keyid for ScheduledQuery>",
            "Effect": "Allow"
        }
    ]
}
```

------

### 执行角色权限（使用客户托管的 KMS 密钥实现计划查询，使用 SSE-KMS 进行错误报告）
<a name="security_iam_id-based-policy-examples-sheduledqueries-execrole"></a>

将以下示例策略附加到 `CreateScheduledQuery` API `ScheduledQueryExecutionRoleArn` 参数中指定的 IAM 角色，该角色使用客户托管的 KMS 密钥实现计划查询以及 `SSE-KMS` 加密进行错误报告。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "kms:GenerateDataKey"
            ],
            "Resource": "arn:aws:kms:us-west-2:123456789012:key/<keyid for ScheduledQuery>",
            "Effect": "Allow"
        },
        {
            "Action": [
                "kms:Decrypt"
            ],
            "Resource": [
                "arn:aws:kms:us-west-2:123456789012:key/<keyid for database-1>",
                "arn:aws:kms:us-west-2:123456789012:key/<keyid for database-n>",
                "arn:aws:kms:us-west-2:123456789012:key/<keyid for ScheduledQuery>"
            ],
            "Effect": "Allow"
        },
        {
            "Action": [
                "sns:Publish"
            ],
            "Resource": [
                "arn:aws:sns:us-west-2:123456789012:scheduled-query-notification-topic-*"
            ],
            "Effect": "Allow"
        },
        {
            "Action": [
                "timestream:Select",
                "timestream:SelectValues",
                "timestream:WriteRecords"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "s3:PutObject",
                "s3:GetBucketAcl"
            ],
            "Resource": [
                "arn:aws:s3:::scheduled-query-error-bucket",
                "arn:aws:s3:::scheduled-query-error-bucket/*"
            ],
            "Effect": "Allow"
        }
    ]
}
```

------

### 执行角色信任关系
<a name="security_iam_id-based-policy-examples-sheduledqueries-exectrust"></a>

以下是 `CreateScheduledQuery` API `ScheduledQueryExecutionRoleArn` 参数中指定的 IAM 角色的信任关系。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": [
                    "timestream.amazonaws.com"
                ]
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
```

------

### 允许访问在账户内创建的所有计划查询
<a name="security_iam_id-based-policy-examples-sheduledqueries-accountid"></a>

将以下示例策略附加到 `CreateScheduledQuery` API `ScheduledQueryExecutionRoleArn` 参数中指定的 IAM 角色，以允许访问在账户中创建的所有计划查询*Account\$1ID*。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "timestream.amazonaws.com"
            },
            "Action": "sts:AssumeRole",
            "Condition": {
                "StringEquals": {
                    "aws:SourceAccount": "Account_ID"
                },
                "ArnLike": {
                    "aws:SourceArn": "arn:aws:timestream:us-west-2:111122223333:scheduled-query/*"
                }
            }
        }
    ]
}
```

------

### 允许访问所有带特定名称的计划查询
<a name="security_iam_id-based-policy-examples-sheduledqueries-queryname"></a>

将以下示例策略附加到 `CreateScheduledQuery` API `ScheduledQueryExecutionRoleArn` 参数中指定的 IAM 角色，以允许访问账户内名称以开头*Scheduled\$1Query\$1Name*的所有计划查询*Account\$1ID*。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "timestream.amazonaws.com"
            },
            "Action": "sts:AssumeRole",
            "Condition": {
                "StringEquals": {
                    "aws:SourceAccount": "Account_ID"
                },
                "ArnLike": {
                    "aws:SourceArn": "arn:aws:timestream:us-west-2:111122223333:scheduled-query/Scheduled_Query_Name*"
                }
            }
        }
    ]
}
```

------

# 对 Amazon Timestream 的 LiveAnalytics 身份和访问权限进行故障排除
<a name="security_iam_troubleshoot"></a>

使用以下信息来帮助您诊断和修复在使用 Timestream for LiveAnalytics 和 IAM 时可能遇到的常见问题。

**Topics**
+ [我无权在 Timestream 中执行以下操作 LiveAnalytics](#security_iam_troubleshoot-no-permissions)
+ [我无权执行 iam：PassRole](#security_iam_troubleshoot-passrole)
+ [我想允许 AWS 账户之外的人访问我的 Timestream 获取资源 LiveAnalytics](#security_iam_troubleshoot-cross-account-access)

## 我无权在 Timestream 中执行以下操作 LiveAnalytics
<a name="security_iam_troubleshoot-no-permissions"></a>

如果 AWS 管理控制台 告诉您您无权执行某项操作，则必须联系管理员寻求帮助。管理员是向您提供登录凭证的人。

当 `mateojackson` IAM 用户尝试使用控制台查看有关表的详细信息*table*但没有该表的`timestream:Select`权限时，就会出现以下示例错误。

```
User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: timestream:Select on resource: mytable
```

在这种情况下，Mateo 请求他的管理员更新其策略，以允许他使用 `timestream:Select` 操作访问 `mytable` 资源。

## 我无权执行 iam：PassRole
<a name="security_iam_troubleshoot-passrole"></a>

如果您收到错误消息，提示您无权执行`iam:PassRole`操作，则必须更新您的策略以允许您将角色传递给 Timestream。 LiveAnalytics

有些 AWS 服务 允许您将现有角色传递给该服务，而不是创建新的服务角色或服务相关角色。为此，您必须具有将角色传递到服务的权限。

当名为的 IAM 用户`marymajor`尝试使用控制台在 Timestream 中执行操作时，就会发生以下示例错误。 LiveAnalytics但是，服务必须具有服务角色所授予的权限才可执行此操作。Mary 不具有将角色传递到服务的权限。

```
User: arn:aws:iam::123456789012:user/marymajor is not authorized to perform: iam:PassRole
```

在这种情况下，必须更新 Mary 的策略以允许她执行 `iam:PassRole` 操作。

如果您需要帮助，请联系您的 AWS 管理员。您的管理员是提供登录凭证的人。

## 我想允许 AWS 账户之外的人访问我的 Timestream 获取资源 LiveAnalytics
<a name="security_iam_troubleshoot-cross-account-access"></a>

您可以创建一个角色，以便其他账户中的用户或您组织外的人员可以使用该角色来访问您的资源。您可以指定谁值得信赖，可以代入角色。对于支持基于资源的策略或访问控制列表 (ACLs) 的服务，您可以使用这些策略向人们授予访问您的资源的权限。

要了解更多信息，请参阅以下内容：
+ 要了解 Timestream 版是否 LiveAnalytics 支持这些功能，请参阅[亚马逊 Timestream 版如何与 IAM 配 LiveAnalytics 合使用](security_iam_service-with-iam.md)。
+ 要了解如何提供对您拥有的资源的访问权限 AWS 账户 ，请参阅 [IAM 用户*指南中的向您拥有 AWS 账户 的另一个 IAM 用户*提供访问](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_aws-accounts.html)权限。
+ 要了解如何向第三方提供对您的资源的访问[权限 AWS 账户，请参阅 *IAM 用户指南*中的向第三方提供](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html)访问权限。 AWS 账户 
+ 要了解如何通过身份联合验证提供访问权限，请参阅《IAM 用户指南》**中的[为经过外部身份验证的用户（身份联合验证）提供访问权限](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_federated-users.html)。
+ 要了解使用角色和基于资源的策略进行跨账户访问之间的差别，请参阅《IAM 用户指南》**中的 [IAM 中的跨账户资源访问](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)。