

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

# AWS Billing Conductor 身分型政策範例
<a name="security_iam_id-based-policy-examples"></a>

根據預設，IAM 使用者和角色沒有建立或修改 Billing Conductor 資源的許可。他們也無法使用 AWS 管理主控台 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)
+ [Billing Conductor 身分型政策範例](#security_policy-examples)
+ [AWS AWS Billing Conductor 的 受管政策](security-iam-awsmanpol.md)
+ [AWS Billing Conductor 資源型政策範例](security_iam_resource-based-policy-examples.md)
+ [對 AWS Billing Conductor 身分和存取進行故障診斷](security_iam_troubleshoot.md)

## 政策最佳實務
<a name="security_iam_service-with-iam-policy-best-practices"></a>

身分型政策會判斷您帳戶中的某個人員是否可以建立、存取或刪除 Billing Conductor 資源。這些動作可能會讓您的 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)。

## Billing Conductor 身分型政策範例
<a name="security_policy-examples"></a>

本主題包含您可以連接到 IAM 使用者或群組的範例政策，以控制對帳戶資訊和工具的存取。

**Topics**
+ [授予 Billing Conductor 主控台的完整存取權](#security_iam_id-based-policy-examples-console)
+ [授予 Billing Conductor API 的完整存取權](#security_iam_id-based-policy-examples-fullAPI)
+ [授予 Billing Conductor 主控台的唯讀存取權](#security_iam_id-based-policy-examples-readonly)
+ [透過 Billing 主控台授予 AWS Billing Conductor 存取權](#security_iam_id-based-policy-examples-ABCthroughbilling)
+ [透過 AWS 成本和用量報告授予帳單執行者存取權](#security_iam_id-based-policy-examples-ABCthroughCUR)
+ [授予 Billing Conductor 對匯入組織單位功能的存取權](#security_iam_id-based-policy-examples-ABCaccessOU)
+ [拒絕 AWS Billing and Cost Explorer 存取不支援形式成本的服務和功能](#deny-access-proforma-costs)
+ [依帳單群組建立形式 CUR](#allow-legacy-cur)

### 授予 Billing Conductor 主控台的完整存取權
<a name="security_iam_id-based-policy-examples-console"></a>

若要存取 Billing Conductor 主控台，您必須擁有一組最低許可。這些許可必須允許您列出和檢視 中 Billing Conductor 資源的詳細資訊 AWS 帳戶。如果您建立比最基本必要許可更嚴格的身分型政策，則對於具有該政策的實體 (IAM 使用者或角色) 而言，主控台就無法如預期運作。

為了確保這些實體仍然可以使用 Billing Conductor 主控台，請將下列 AWS 受管政策連接至實體。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[將許可新增至使用者](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_change-permissions.html#users_change_permissions-add-console)：

除了`billingconductor:*`許可之外， `pricing:DescribeServices` 是建立定價規則的必要項目，也`organizations:ListAccounts`需要列出連結至付款人帳戶的連結帳戶。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "billingconductor:*",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "organizations:ListAccounts",
                "organizations:DescribeAccount"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": "pricing:DescribeServices",
            "Resource": "*"
        }
    ]
}
```

------

對於僅呼叫 AWS CLI 或 AWS API 的使用者，您不需要允許最低主控台許可。反之，只需允許存取符合您嘗試執行之 API 作業的動作就可以了。

### 授予 Billing Conductor API 的完整存取權
<a name="security_iam_id-based-policy-examples-fullAPI"></a>

在此範例中，您會授予 IAM 實體對 Billing Conductor API 的完整存取權。

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

****  

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

------

### 授予 Billing Conductor 主控台的唯讀存取權
<a name="security_iam_id-based-policy-examples-readonly"></a>

在此範例中，您將 Billing Conductor 主控台的唯讀存取權授予 IAM 實體。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "billingconductor:List*",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": "organizations:ListAccounts",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": "pricing:DescribeServices",
            "Resource": "*"
        }
    ]
}
```

------

### 透過 Billing 主控台授予 AWS Billing Conductor 存取權
<a name="security_iam_id-based-policy-examples-ABCthroughbilling"></a>

在此範例中，IAM 實體可以透過帳單主控台中的帳單頁面切換和檢視形式 AWS 帳單資料。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "billing:ListBillingViews",
                "aws-portal:ViewBilling"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 透過 AWS 成本和用量報告授予帳單執行者存取權
<a name="security_iam_id-based-policy-examples-ABCthroughCUR"></a>

在此範例中，IAM 實體可以透過其帳單主控台中的成本和用量報告頁面切換和檢視形式 AWS 帳單資料。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "billing:ListBillingViews",
                "aws-portal:ViewBilling",
                "cur:DescribeReportDefinitions"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 授予 Billing Conductor 對匯入組織單位功能的存取權
<a name="security_iam_id-based-policy-examples-ABCaccessOU"></a>

在此範例中，IAM 實體可以唯讀存取您在建立帳單群組時匯入組織單位 (OU) 帳戶所需的特定 AWS Organizations API 操作。匯入 OU 功能位於 AWS Billing Conductor 主控台。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "organizations:ListRoots",
                "organizations:ListOrganizationalUnitsForParent",
                "organizations:ListChildren"
            ],
            "Resource": "*"
        }
    ]
}
```

------

### 拒絕 AWS Billing and Cost Explorer 存取不支援形式成本的服務和功能
<a name="deny-access-proforma-costs"></a>

在此範例中，IAM 實體無法存取不支援形式成本的服務和功能。此政策包含管理帳戶和個別成員帳戶中可能的 動作清單。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [{
        "Effect": "Deny",
        "Action": [
            "aws-portal:ModifyAccount",
            "aws-portal:ModifyBilling",
            "aws-portal:ModifyPaymentMethods",
            "aws-portal:ViewPaymentMethods",
            "aws-portal:ViewAccount",
            "cur:GetClassic*",
            "cur:Validate*",
            "tax:List*",
            "tax:Get*",
            "tax:Put*",
            "tax:ListTaxRegistrations",
            "tax:BatchPut*",
            "tax:UpdateExemptions",
            "freetier:Get*",
            "payments:Get*",
            "payments:List*",
            "payments:Update*",
            "payments:GetPaymentInstrument",
            "payments:GetPaymentStatus",
            "purchase-orders:ListPurchaseOrders",
            "purchase-orders:ListPurchaseOrderInvoices",
            "consolidatedbilling:GetAccountBillingRole",
            "consolidatedbilling:Get*",
            "consolidatedbilling:List*",
            "invoicing:List*",
            "invoicing:Get*",
            "account:Get*",
            "account:List*",
            "account:CloseAccount",
            "account:DisableRegion",
            "account:EnableRegion",
            "account:GetContactInformation",
            "account:GetAccountInformation",
            "account:PutContactInformation",
            "billing:GetBillingPreferences",
            "billing:GetContractInformation",
            "billing:GetCredits",
            "billing:RedeemCredits",
            "billing:Update*",
            "ce:GetPreferences",
            "ce:UpdatePreferences",
            "ce:GetReservationCoverage",
            "ce:GetReservationPurchaseRecommendation",
            "ce:GetReservationUtilization",
            "ce:GetSavingsPlansCoverage",
            "ce:GetSavingsPlansPurchaseRecommendation",
            "ce:GetSavingsPlansUtilization",
            "ce:GetSavingsPlansUtilizationDetails",
            "ce:ListSavingsPlansPurchaseRecommendationGeneration",
            "ce:StartSavingsPlansPurchaseRecommendationGeneration",
            "ce:UpdateNotificationSubscription"
        ],
        "Resource": "*"
    }]
}
```

------

如需詳細資訊，請參閱[AWS 服務 支援以形式為基礎的計費檢視成本](service-integrations-support-proforma.md)。

### 依帳單群組建立形式 CUR
<a name="allow-legacy-cur"></a>

步驟 1：允許 IAM 使用者完整存取舊版 CUR 和帳單群組帳單檢視。

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
        "Sid": "CurDataAccess",
        "Effect": "Allow",
        "Action": "cur:PutReportDefinition",
        "Resource": [
            "arn:*:cur:*:*:definition/*",
            "arn:aws:billing::*:billingview/*"
        ]
      }
    ]
}
```

步驟 2：若要將 IAM 角色指派為可存取特定帳單群組，請新增使用者可存取的帳單檢視 ARN。

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "CurDataAccess",
            "Effect": "Allow",
            "Action": "cur:PutReportDefinition",
            "Resource":[
                "arn:aws:cur:us-east-1:123456789012:definition/*",
                "arn:aws:billing::AWS-account-ID:billingview/billing-group-$billinggroup-primary-account-ID"
                ]
        }
    ]
}
```

如需詳細資訊，請參閱[依帳單群組設定成本和用量報告](configuring-abc.md)。