

如需與 Amazon Timestream for LiveAnalytics 類似的功能，請考慮使用 Amazon Timestream for InfluxDB。它提供簡化的資料擷取和單一位數毫秒查詢回應時間，以進行即時分析。[在這裡](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html)進一步了解。

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

# Amazon Timestream for LiveAnalytics 的身分和存取管理
<a name="security-iam"></a>

AWS Identity and Access Management (IAM) 是 AWS 服務 ，可協助管理員安全地控制對 AWS 資源的存取。IAM 管理員可控制誰可以*進行身分驗證* （登入） 和*授權* （具有許可），以使用 Timestream for LiveAnalytics 資源。IAM 是您可以免費使用 AWS 服務 的 。

**Topics**
+ [目標對象](#security_iam_audience)
+ [使用身分驗證](#security_iam_authentication)
+ [使用政策管理存取權](#security_iam_access-manage)
+ [Amazon Timestream for LiveAnalytics 如何與 IAM 搭配使用](security_iam_service-with-iam.md)
+ [AWS Amazon Timestream Live Analytics 的 受管政策](security-iam-awsmanpol.md)
+ [Amazon Timestream for LiveAnalytics 身分型政策範例](security_iam_id-based-policy-examples.md)
+ [對 Amazon Timestream for LiveAnalytics 身分和存取進行故障診斷](security_iam_troubleshoot.md)

## 目標對象
<a name="security_iam_audience"></a>

使用方式 AWS Identity and Access Management (IAM) 會根據您的角色而有所不同：
+ **服務使用者** — 若無法存取某些功能，請向管理員申請所需許可 (請參閱 [對 Amazon Timestream for LiveAnalytics 身分和存取進行故障診斷](security_iam_troubleshoot.md))
+ **服務管理員** — 負責設定使用者存取權並提交相關許可請求 (請參閱 [Amazon Timestream for LiveAnalytics 如何與 IAM 搭配使用](security_iam_service-with-iam.md))
+ **IAM 管理員** — 撰寫政策以管理存取控制 (請參閱 [Amazon Timestream for LiveAnalytics 身分型政策範例](security_iam_id-based-policy-examples.md))

## 使用身分驗證
<a name="security_iam_authentication"></a>

身分驗證是您 AWS 使用身分憑證登入 的方式。您必須以 AWS 帳戶根使用者、IAM 使用者或擔任 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](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) 。

[IAM 群組](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](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 受管政策。

### 存取控制清單 (ACL)
<a name="security_iam_access-manage-acl"></a>

存取控制清單 (ACL) 可控制哪些主體 (帳戶成員、使用者或角色) 擁有存取某資源的許可。ACL 類似於資源型政策，但它們不使用 JSON 政策文件格式。

Amazon S3 AWS WAF和 Amazon VPC 是支援 ACLs的服務範例。如需進一步了解 ACL，請參閱《Amazon Simple Storage Service 開發人員指南》**中的[存取控制清單 (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)。
+ **服務控制政策 (SCP)** — 為 AWS Organizations中的組織或組織單位指定最大許可。如需詳細資訊，請參閱《AWS Organizations 使用者指南》**中的[服務控制政策](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html)。
+ **資源控制政策 (RCP)** — 設定您帳戶中資源可用許可的上限。如需詳細資訊，請參閱《AWS Organizations 使用者指南》**中的[資源控制政策 (RCP)](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)。

# Amazon Timestream for LiveAnalytics 如何與 IAM 搭配使用
<a name="security_iam_service-with-iam"></a>

在您使用 IAM 管理 Timestream for LiveAnalytics 的存取權之前，您應該了解哪些 IAM 功能可與 Timestream for LiveAnalytics 搭配使用。若要全面了解 Timestream for LiveAnalytics 和其他 AWS 服務如何與 IAM 搭配使用，請參閱《*IAM 使用者指南*》中的與 [AWS IAM 搭配使用的 服務](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)。

**Topics**
+ [LiveAnalytics 身分型政策的 Timestream](#security_iam_service-with-iam-id-based-policies)
+ [LiveAnalytics 資源型政策的 Timestream](#security_iam_service-with-iam-resource-based-policies)
+ [根據 Timestream for LiveAnalytics 標籤的授權](#security_iam_service-with-iam-tags)
+ [LiveAnalytics IAM 角色的 Timestream](#security_iam_service-with-iam-roles)

## LiveAnalytics 身分型政策的 Timestream
<a name="security_iam_service-with-iam-id-based-policies"></a>

使用 IAM 身分型政策，您可以指定允許或拒絕的動作和資源，以及在何種條件下允許或拒絕動作。Timestream for LiveAnalytics 支援特定動作和資源，以及條件索引鍵。若要了解您在 JSON 政策中使用的所有元素，請參閱 *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 政策陳述式的動作元素中指定下列動作。使用政策來授予在 AWS中執行操作的許可。當您在政策中使用 動作時，通常會允許或拒絕存取具有相同名稱的 API 操作、CLI 命令或 SQL 命令。

 在某些情況下，單一動作會控制對 API 操作和 SQL 命令的存取。或者，某些操作需要多種不同的動作。

如需 LiveAnalytics 支援之 Timestream 的清單`Action`，請參閱下表：

**注意**  
對於所有資料庫特定的 `Actions`，您可以指定資料庫 ARN，將動作限制在特定資料庫。


| 動作 | 描述 | 存取層級 | 資源類型 (\$1必填項目) | 
| --- | --- | --- | --- | 
|  DescribeEndpoint  |  傳回必須對其提出後續請求的 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  |  將資料插入 Timestream。  |  寫入  |  資料表\$1  | 
|  CreateTable  |  建立資料表。  |  寫入  |  資料庫\$1  | 
|  CreateDatabase  |  建立資料庫。  |  寫入  |  \$1  | 
|  DeleteDatabase  |  刪除資料庫。  |  寫入  |  \$1  | 
|  UpdateDatabase  |  更新資料庫。  |  寫入  |  \$1  | 
|  DeleteTable  |  刪除資料表。  |  寫入  |  資料庫\$1  | 
|  UpdateTable  |  更新資料表。  |  寫入  |  資料庫\$1  | 

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

`SelectValues` 是 `Action`，用於*不需要*資源的查詢。不需要資源的查詢範例如下：

```
SELECT 1
```

請注意，此查詢不會參考特定 Timestream for LiveAnalytics 資源。請考慮另一個範例：

```
SELECT now()
```

此查詢會傳回使用 `now()`函數的目前時間戳記，但不需要指定資源。 `SelectValues` 通常用於測試，因此 Timestream for LiveAnalytics 可以在沒有資源的情況下執行查詢。現在，請考慮`Select`查詢：

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

這種類型的查詢需要資源，具體而言是適用於 LiveAnalytics `table` 的 Timestream，以便可以從資料表擷取指定的資料。

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

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

`Resource` JSON 政策元素可指定要套用動作的物件。最佳實務是使用其 [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) 來指定資源。若動作不支援資源層級許可，使用萬用字元 (\$1) 表示該陳述式適用於所有資源。

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

在 Timestream for LiveAnalytics 中，資料庫和資料表可用於 IAM 許可的 `Resource`元素。

Timestream for LiveAnalytics 資料庫資源具有下列 ARN：

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

Timestream for LiveAnalytics 資料表資源具有下列 ARN：

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

如需 ARNs 格式的詳細資訊，請參閱 [Amazon Resource Name (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/*"
```

有些 Timestream for LiveAnalytics 動作無法在特定資源上執行，例如用於建立資源的動作。在這些情況下，您必須使用萬用字元 (\$1)。

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

### 條件索引鍵
<a name="security_iam_service-with-iam-id-based-policies-conditionkeys"></a>

LiveAnalytics 的 Timestream 不提供任何服務特定的條件金鑰，但支援使用一些全域條件金鑰。若要查看所有 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>

若要檢視 Timestream for LiveAnalytics 身分型政策的範例，請參閱 [Amazon Timestream for LiveAnalytics 身分型政策範例](security_iam_id-based-policy-examples.md)。

## LiveAnalytics 資源型政策的 Timestream
<a name="security_iam_service-with-iam-resource-based-policies"></a>

LiveAnalytics 的 Timestream 不支援以資源為基礎的政策。若要檢視詳細資源類型政策頁面的範例，請參閱 [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)。

## 根據 Timestream for LiveAnalytics 標籤的授權
<a name="security_iam_service-with-iam-tags"></a>

您可以使用標籤來管理 Timestream for LiveAnalytics 資源的存取。若要根據標籤管理資源存取，您可以使用 `aws:RequestTag/key-name`、 `timestream:ResourceTag/key-name`或 [條件索引鍵，在政策的條件元素](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)中提供標籤資訊。 `aws:TagKeys`如需標記 Timestream for LiveAnalytics 資源的詳細資訊，請參閱 [將標籤新增至資源](tagging-keyspaces.md)。

若要檢視身分型政策範例，用於根據該資源的標籤來限制資源的存取權，請參閱「[根據標籤的 LiveAnalytics 資源存取時間串流](security_iam_id-based-policy-examples.md#security_iam_id-based-policy-examples-tags)」。

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

[IAM 角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)是您 AWS 帳戶中具有特定許可的實體。

### 搭配 Timestream for LiveAnalytics 使用臨時登入資料
<a name="security_iam_service-with-iam-roles-tempcreds"></a>

您可以搭配聯合使用暫時憑證、擔任 IAM 角色，或是擔任跨帳戶角色。您可以透過呼叫 [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) 或 [GetFederationToken](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html) 等 AWS STS API 操作來取得臨時安全登入資料。

### 服務連結角色
<a name="security_iam_service-with-iam-roles-service-linked"></a>

LiveAnalytics 的 Timestream 不支援服務連結角色。

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

LiveAnalytics 的 Timestream 不支援服務角色。

# AWS Amazon 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 最有可能更新 AWS 受管政策。

如需詳細資訊，請參閱 *IAM 使用者指南*中的 [AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)。

**Topics**
+ [AmazonTimestreamInfluxDBFullAccess](#security-iam-awsmanpol-AmazonTimestreamInfluxDBFullAccess)
+ [AmazonTimestreamReadOnlyAccess](#security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess)
+ [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess)
+ [AmazonTimestreamFullAccess](#security-iam-awsmanpol-AmazonTimestreamFullAccess)
+ [政策更新](#security-iam-awsmanpol-updates)









## AWS 受管政策：AmazonTimestreamInfluxDBFullAccess
<a name="security-iam-awsmanpol-AmazonTimestreamInfluxDBFullAccess"></a>

您可以將 `AmazonTimestreamInfluxDBFullAccess` 連接至使用者、群組與角色。建立、更新、刪除和列出 Amazon Timestream InfluxDB 執行個體的政策存取權。

**許可詳細資訊**  
此政策包含以下許可：
+ `Amazon Timestream` – 提供建立、更新、刪除和列出 Amazon Timestream InfluxDB 執行個體，以及建立和列出參數群組的完整管理存取權。

若要以 JSON 格式檢閱此政策，請參閱 [AmazonTimestreamInfluxDBFullAccess](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` 連接至使用者、群組與角色。

此政策提供使用 管理 Amazon Timestream 的完整存取權 AWS 管理主控台。此政策也會授予特定 AWS KMS 操作和操作的許可，以管理已儲存的查詢。

**許可詳細資訊**  
此政策包含以下許可：
+ `Amazon Timestream` – 授予委託人對 Amazon Timestream 的完整存取權。
+ `AWS KMS` – 允許主體列出別名並描述索引鍵。
+ `Amazon S3` – 允許主體列出所有 Amazon S3 儲存貯體。
+ `Amazon SNS` – 允許主體列出 Amazon SNS 主題。
+ `IAM` – 允許主體列出 IAM 角色。
+ `DBQMS` – 允許主體存取、建立、刪除、說明和更新查詢。資料庫查詢中繼資料服務 (dbqms) 是僅限內部的服務。它為多個 上的查詢編輯器提供最近和已儲存 AWS 管理主控台 的查詢 AWS 服務，包括 Amazon Timestream。
+ `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)。

## AWS 受管政策的 Timestream Live Analytics 更新
<a name="security-iam-awsmanpol-updates"></a>



檢視自此服務開始追蹤這些變更以來，Timestream Live Analytics AWS 受管政策更新的詳細資訊。如需此頁面變更的自動提醒，請訂閱 [Timestream Live Analytics 文件歷史記錄](doc-history.md)頁面上的 RSS 摘要。




| 變更 | 描述 | Date | 
| --- | --- | --- | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess) – 更新現有政策  |  Timestream for InfluxDB 已將 Influx Enterprise Marketplace 產品 ID 新增至現有`AmazonTimestreamInfluxDBFullAccess`受管政策，以支援企業市集方案的訂閱。這些許可是透過限制只能存取特定 的條件，僅限於特定 AWS Marketplace 產品`ProductIds`。請參閱 [AmazonTimestreamInfluxDBFullAccess](https://docs.aws.amazon.com/timestream/latest/developerguide/security-iam-awsmanpol-influxdb.html#iam.identitybasedpolicies.predefinedpolicies)。  | 2025 年 10 月 17 日 | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess) – 更新至現有政策  |  將 AWS Marketplace 許可新增至現有的`AmazonTimestreamConsoleFullAccess`受管政策，以存取市集資源並建立具有僅供讀取複本的 InfluxDB 叢集的協議。 Timestream Live Analytics 也透過新增 `Sid` 欄位來更新此受管政策。 政策更新不會影響`AmazonTimestreamConsoleFullAccess`受管政策的使用。  | 2025 年 8 月 20 日 | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess) – 更新至現有政策  |  將 `pricing:GetProducts`動作新增至現有的 `AmazonTimestreamConsoleFullAccess` 受管政策，以在建立期間提供 InfluxDB 資源組態的定價估算。 政策更新不會影響`AmazonTimestreamConsoleFullAccess`受管政策的使用。  | 2025 年 6 月 10 日 | 
|  [AmazonTimestreamReadOnlyAccess](#security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess) – 更新至現有政策  |  已將 `timestream:DescribeAccountSettings`動作新增至現有的 `AmazonTimestreamReadOnlyAccess` 受管政策。此動作用於描述 AWS 帳戶 設定。 Timestream Live Analytics 也透過新增 `Sid` 欄位來更新此受管政策。 政策更新不會影響`AmazonTimestreamReadOnlyAccess`受管政策的使用。  | 2024 年 6 月 3 日 | 
|  [AmazonTimestreamReadOnlyAccess](#security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess) – 更新至現有政策  |  已將 `timestream:DescribeBatchLoadTask`和 `timestream:ListBatchLoadTasks`動作新增至現有的 `AmazonTimestreamReadOnlyAccess` 受管政策。列出和描述批次載入任務時，會使用這些動作。 政策更新不會影響`AmazonTimestreamReadOnlyAccess`受管政策的使用。  | 2023 年 2 月 24 日 | 
|  [AmazonTimestreamReadOnlyAccess](#security-iam-awsmanpol-AmazonTimestreamReadOnlyAccess) – 更新至現有政策  |  已將 `timestream:DescribeScheduledQuery`和 `timestream:ListScheduledQueries`動作新增至現有的 `AmazonTimestreamReadOnlyAccess` 受管政策。列出和描述現有的排程查詢時，會使用這些動作。 政策更新不會影響`AmazonTimestreamReadOnlyAccess`受管政策的使用。  | 2021 年 11 月 29 日 | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess) – 更新至現有政策  |  已將 `s3:ListAllMyBuckets`動作新增至現有的 `AmazonTimestreamConsoleFullAccess` 受管政策。當您為 Timestream 指定 Amazon S3 儲存貯體以記錄磁性存放區寫入錯誤時，會使用此動作。 政策更新不會影響`AmazonTimestreamConsoleFullAccess`受管政策的使用。  | 2021 年 11 月 29 日 | 
|  [AmazonTimestreamFullAccess](#security-iam-awsmanpol-AmazonTimestreamFullAccess) – 更新現有政策  |  已將 `s3:ListAllMyBuckets`動作新增至現有的 `AmazonTimestreamFullAccess` 受管政策。當您為 Timestream 指定 Amazon S3 儲存貯體以記錄磁性存放區寫入錯誤時，會使用此動作。 政策更新不會影響`AmazonTimestreamFullAccess`受管政策的使用。  | 2021 年 11 月 29 日 | 
|  [AmazonTimestreamConsoleFullAccess](#security-iam-awsmanpol-AmazonTimestreamConsoleFullAccess) – 更新至現有政策  |  從現有的 `AmazonTimestreamConsoleFullAccess`受管政策中移除備援動作。先前，此政策包含備援動作 `dbqms:DescribeQueryHistory`。更新的政策會移除備援動作。 政策更新不會影響`AmazonTimestreamConsoleFullAccess`受管政策的使用。  | 2021 年 4 月 23 日 | 
|  Timestream Live Analytics 開始追蹤變更  |  Timestream Live Analytics 開始追蹤其 AWS 受管政策的變更。  | 2021 年 4 月 21 日 | 

# Amazon Timestream for LiveAnalytics 身分型政策範例
<a name="security_iam_id-based-policy-examples"></a>

根據預設，IAM 使用者和角色沒有建立或修改 Timestream for LiveAnalytics 資源的許可。他們也無法使用 AWS 管理主控台、CQLSH AWS CLI、 或 AWS API 執行任務。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)
+ [使用 Timestream for LiveAnalytics 主控台](#security_iam_id-based-policy-examples-console)
+ [允許使用者檢視他們自己的許可](#security_iam_id-based-policy-examples-view-own-permissions)
+ [Timestream for 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>

身分型政策會判斷您帳戶中的某人是否可以建立、存取或刪除 Timestream for LiveAnalytics 資源。這些動作可能會讓您的 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)** – 如果您的案例需要 IAM 使用者或 中的根使用者 AWS 帳戶，請開啟 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)。

## 使用 Timestream for LiveAnalytics 主控台
<a name="security_iam_id-based-policy-examples-console"></a>

LiveAnalytics 的 Timestream 不需要特定許可，即可存取 Amazon Timestream for LiveAnalytics 主控台。您需要至少 個唯讀許可，才能列出和檢視 AWS 您帳戶中 Timestream for 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 for LiveAnalytics 中的常見操作
<a name="security_iam_id-based-policy-examples-common-operations"></a>

以下是允許 Timestream for LiveAnalytics 服務中常見操作的 IAM 政策範例。

**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 for 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 for 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>

下列範例政策允許使用者在帳戶 `database/sampleDB/table/DevOps`中的 上執行 `INSERT`操作`<account_id>`。

**注意**  
將 取代`<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 for LiveAnalytics 中執行 CRUD 操作。

------
#### [ 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>

下列範例政策允許使用者建立資料表、描述資料表、刪除資料表、更新資料表，以及對資料庫 `DevOps`中的資料表執行`Select`查詢`sampleDB`：

------
#### [ 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>

您可以在身分型政策中使用條件，根據標籤控制對 Timestream for LiveAnalytics 資源的存取。本節將提供一些範例。

下列範例示範如何建立政策，在資料表的 `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`嘗試檢視 Timestream for 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`或 的資料庫上使用 `DescribeDatabase` API`test`：

------
#### [ 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": "*"
        }
    ]
}
```

------

### 使用客戶受管 KMS 金鑰的 CreateScheduledQuery
<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>

將下列範例政策連接至 `ScheduledQueryExecutionRoleArn` 參數中指定的 IAM 角色，該 `CreateScheduledQuery` API 使用客戶受管 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>

將下列範例政策連接至 `ScheduledQueryExecutionRoleArn` `CreateScheduledQuery` API 參數中指定的 IAM 角色，以允許存取帳戶 *Account\$1ID* 中名稱開頭為 *Scheduled\$1Query\$1Name* 的所有排程查詢。

------
#### [ 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 for LiveAnalytics 身分和存取進行故障診斷
<a name="security_iam_troubleshoot"></a>

使用以下資訊來協助您診斷和修正使用 Timestream for LiveAnalytics 和 IAM 時可能遇到的常見問題。

**Topics**
+ [我無權在 Timestream for LiveAnalytics 中執行動作](#security_iam_troubleshoot-no-permissions)
+ [我未獲得執行 iam:PassRole 的授權](#security_iam_troubleshoot-passrole)
+ [我想要允許 AWS 帳戶外的人員存取我的 Timestream for LiveAnalytics 資源](#security_iam_troubleshoot-cross-account-access)

## 我無權在 Timestream for LiveAnalytics 中執行動作
<a name="security_iam_troubleshoot-no-permissions"></a>

如果 AWS 管理主控台 告知您無權執行 動作，則必須聯絡您的管理員尋求協助。您的管理員是為您提供簽署憑證的人員。

當 IAM `mateojackson` 使用者嘗試使用主控台檢視*資料表*的詳細資訊，但沒有資料表的`timestream:Select`許可時，會發生下列範例錯誤。

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

在此情況下，Mateo 會請求管理員更新他的政策，允許他使用 `mytable` 動作存取 `timestream:Select` 資源。

## 我未獲得執行 iam:PassRole 的授權
<a name="security_iam_troubleshoot-passrole"></a>

如果您收到錯誤，告知您無權執行 `iam:PassRole`動作，您的政策必須更新，以允許您將角色傳遞至 Timestream for LiveAnalytics。

有些 AWS 服務 可讓您將現有角色傳遞給該服務，而不是建立新的服務角色或服務連結角色。如需執行此作業，您必須擁有將角色傳遞至該服務的許可。

當名為 的 IAM `marymajor` 使用者嘗試使用主控台在 Timestream for LiveAnalytics 中執行動作時，會發生下列範例錯誤。但是，動作請求服務具備服務角色授予的許可。Mary 沒有將角色傳遞給服務的許可。

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

在這種情況下，Mary 的政策必須更新，允許她執行 `iam:PassRole` 動作。

如果您需要協助，請聯絡您的 AWS 管理員。您的管理員提供您的簽署憑證。

## 我想要允許 AWS 帳戶外的人員存取我的 Timestream for LiveAnalytics 資源
<a name="security_iam_troubleshoot-cross-account-access"></a>

您可以建立一個角色，讓其他帳戶中的使用者或您組織外部的人員存取您的資源。您可以指定要允許哪些信任物件取得該角色。針對支援基於資源的政策或存取控制清單 (ACL) 的服務，您可以使用那些政策來授予人員存取您的資源的許可。

如需進一步了解，請參閱以下內容：
+ 若要了解 Timestream for LiveAnalytics 是否支援這些功能，請參閱 [Amazon Timestream for LiveAnalytics 如何與 IAM 搭配使用](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 使用者指南*》中的[將存取權提供給第三方 AWS 帳戶 擁有](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html)。
+ 如需了解如何透過聯合身分提供存取權，請參閱《*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)。