

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

# 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 账单指挥官的托管策略](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>

Identity-based 策略决定了某人是否可以在您的账户中创建、访问或删除 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**)-如果 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)。

## Billing Conductor 基于身份策略示例
<a name="security_policy-examples"></a>

本主题包含几个示例策略，您可以将它们附加到您的 IAM 用户或组以控制对您的账户的信息和工具的访问权限。

**Topics**
+ [授予对 Billing Condoctor 控制台的完全访问权限](#security_iam_id-based-policy-examples-console)
+ [授予对 Billing Condoctor API 的完全访问权限](#security_iam_id-based-policy-examples-fullAPI)
+ [授予对 Billing Condoctor 控制台的只读访问权限](#security_iam_id-based-policy-examples-readonly)
+ [通过账单控制台授予 AWS 账单指挥访问权限](#security_iam_id-based-policy-examples-ABCthroughbilling)
+ [通过 AWS 成本和使用情况报告授予计费指挥员访问权限](#security_iam_id-based-policy-examples-ABCthroughCUR)
+ [授予 Billing Conductor 对导入组织单位功能的访问权限](#security_iam_id-based-policy-examples-ABCaccessOU)
+ [拒绝 Billing 和 Cost Explorer 访问不支持形式 AWS 费用的服务和功能](#deny-access-proforma-costs)
+ [按账单组创建预算 CUR](#allow-legacy-cur)

### 授予对 Billing Condoctor 控制台的完全访问权限
<a name="security_iam_id-based-policy-examples-console"></a>

要访问 Billing Conductor 控制台，您必须拥有一组最低权限。这些权限必须允许您列出和查看有关您的 AWS 账户中的 Billing Conductor 资源的详细信息。如果您创建的基于身份的策略比所需的最低权限更严格，则无法为具有该策略的实体（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 Condoctor 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 Condoctor 控制台的只读访问权限
<a name="security_iam_id-based-policy-examples-readonly"></a>

在本示例中，您授予 IAM 实体对 Billing Conductor 控制台的只读访问权限。

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

****  

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

------

### 通过账单控制台授予 AWS 账单指挥访问权限
<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 功能在 B AWS illing Conductor 控制台上。

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

****  

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

------

### 拒绝 Billing 和 Cost Explorer 访问不支持形式 AWS 费用的服务和功能
<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)。