

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

# 資料匯出的身分和存取管理
<a name="bcm-data-exports-access"></a>

AWS Identity and Access Management (IAM) 是一種 AWS 服務，可協助管理員安全地控制對 AWS 資源的存取。IAM 管理員會控制誰可經*身分驗證* (已登入) 和*授權* (具有許可) 來使用 Billing 資源。IAM 是一項服務 AWS ，您可以免費使用。

若要使用資料匯出，IAM 使用者需要獲得 IAM 中 動作`bcm-data-exports namespace`的存取權。如需可用的動作，請參閱下表。


****  

| 資料匯出動作 | Description | 存取層級 | 資源類型 | 條件索引鍵 | 
| --- | --- | --- | --- | --- | 
| CreateExport | 允許使用者建立匯出，並指定查詢、交付組態、排程組態和內容組態。 | 寫入 |  匯出 資料表  |  aws:RequestTag/\$1\$1TagKey\$1 aws:TagKeys  | 
| UpdateExport | 允許使用者更新現有的匯出。 | 寫入 |  匯出 資料表  |  aws:ResourceTag/\$1\$1TagKey\$1  | 
| DeleteExport | 允許使用者刪除現有的匯出。 | 寫入 |  匯出  |  aws:ResourceTag/\$1\$1TagKey\$1  | 
| GetExport | 允許使用者檢視現有的匯出。 | 讀取 |  匯出  |  aws:ResourceTag/\$1\$1TagKey\$1  | 
| ListExports | 允許使用者列出所有現有的匯出。 | 讀取 |  |  | 
| GetExecution | 允許使用者查看指定執行的詳細資訊，包括匯出資料的中繼資料和結構描述。 | 讀取 |  匯出  |  aws:ResourceTag/\$1\$1TagKey\$1  | 
| ListExecutions | 允許使用者列出所提供匯出識別符的所有執行。 | 讀取 |  匯出  |  aws:ResourceTag/\$1\$1TagKey\$1  | 
| GetTable | 允許使用者取得指定資料表的結構描述。 | 讀取 |  資料表  |  | 
| ListTables | 允許使用者列出所有可用的資料表。 | 讀取 |  |  | 
| TagResource | 允許使用者標記現有的匯出。 | 寫入 |  匯出  |  aws:ResourceTag/\$1\$1TagKey\$1 aws:RequestTag/\$1\$1TagKey\$1 aws:TagKeys  | 
| UntagResource | 允許使用者取消標記現有的匯出。 | 寫入 |  匯出  |  aws:ResourceTag/\$1\$1TagKey\$1 aws:TagKeys  | 
| ListTagsForResource | 允許使用者列出與現有匯出相關聯的標籤。 | 讀取 |  匯出  |  aws:ResourceTag/\$1\$1TagKey\$1  | 

如需如何使用這些內容金鑰的詳細資訊，請參閱《*IAM 使用者指南*》中的[使用標籤控制對 資源的存取 AWS](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html)。

下表說明資料匯出中可用的資源類型。


****  

| Resource Type (資源類型) | Description | ARN | 
| --- | --- | --- | 
| 匯出 | 匯出是由 CreateExport API 建立的資源。匯出會定期產生帳單和成本管理查詢輸出。 | arn：\$1\$1Partition\$1：bcm-data-exports：\$1\$1Region\$1：\$1\$1Account\$1：export/\$1\$1exportName\$1-\$1UUID\$1 | 
| 資料表 | 資料表是使用者透過匯出查詢的資料列格式的資料。資料表是由 AWS 為客戶建立和管理。客戶無法刪除資料表。 | arn：\$1\$1Partition\$1：bcm-data-exports：\$1\$1Region\$1：\$1\$1Account\$1：table/\$1\$1TableName\$1 | 

若要在資料匯出中建立 COST\$1AND\$1USAGE\$1REPORT 或 COST\$1AND\$1USAGE\$1DASHBOARD 資料表資源的匯出，IAM 使用者也必須具有 IAM 中個別`cur`動作的許可。這表示如果 IAM 使用者因為任何原因無法使用`cur`動作，例如缺少 上的明確允許`cur`或服務控制政策 (SCP) 在 上提供明確拒絕`cur`，則該 IAM 使用者將遭到封鎖，無法建立或更新這兩個資料表的匯出。

下表顯示這兩個資料表在資料匯出中`cur`需要哪些`bcm-data-exports`動作。


****  

| 資料匯出動作 | 資料表資源 | IAM 中的其他必要動作 | 
| --- | --- | --- | 
| bcm-data-exports：CreateExport |  COST\$1AND\$1USAGE\$1REPORT COST\$1AND\$1USAGE\$1DASHBOARD  | cur:PutReportDefinition | 

## 政策範例
<a name="bcm-data-exports-access-examples"></a>

允許 IAM 使用者完整存取資料匯出中的 CUR 2.0 匯出。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ViewDataExportsTablesAndExports",
            "Effect": "Allow",
            "Action": [
                "bcm-data-exports:ListTables",
                "bcm-data-exports:ListExports",
                "bcm-data-exports:GetExport"
            ],
            "Resource": "*"
        },
        {
            "Sid": "CreateCurExports",
            "Effect": "Allow",
            "Action": "bcm-data-exports:*",
            "Resource": [
                "arn:aws:bcm-data-exports:*:*:table/COST_AND_USAGE_REPORT",
                "arn:aws:bcm-data-exports:*:*:export/*"
                ]
        },
        {
            "Sid": "CurDataAccess",
            "Effect": "Allow",
            "Action":  "cur:PutReportDefinition",
            "Resource": "*"
         }
    ]
}
```

------

如需在 Billing and Cost Management 中使用資料匯出的存取控制和 IAM 許可的詳細資訊，請參閱[管理存取許可概觀](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/control-access-billing.html)。

### 建立形式 AWS CUR 2.0
<a name="bcm-data-exports-access-examples-2"></a>

若要建立形式 CUR 2.0，您需要包含下列 IAM 政策：

允許 IAM 使用者完整存取 CUR 2.0 和帳單群組帳單檢視。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowCreateCur20AnyBillingView",
            "Effect": "Allow",
            "Action": "bcm-data-exports:CreateExport",
            "Resource": [
                "arn:aws:bcm-data-exports:*:*:table/COST_AND_USAGE_REPORT",
                "arn:aws:bcm-data-exports:*:*:export/*",
                "arn:aws:billing::*:billingview/*"
            ]
        },{
            "Sid": "CurDataAccess",
            "Effect": "Allow",
            "Action": "cur:PutReportDefinition",
            "Resource": "*"
        }
    ]
}
```

------

如果您希望 IAM 角色能夠存取特定帳單群組，您可以新增該角色可存取的 Billing View ARN。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowCreateSpecificBillingViewCur20",
            "Effect": "Allow",
            "Action": "bcm-data-exports:CreateExport",
            "Resource": [
                "arn:aws:bcm-data-exports:*:*:table/COST_AND_USAGE_REPORT", 
                "arn:aws:bcm-data-exports:*:*:export/*", 
                "arn:aws:billing::444455556666:billingview/billing-group-111122223333"
        ]
        },{
            "Sid": "CurDataAccess",
            "Effect": "Allow",
            "Action": "cur:PutReportDefinition",
            "Resource": "*"
        }
    ]
}
```

------