AWS 帳單政策範例 - AWS 帳單
允許 IAM 使用者檢視您的帳單資訊允許 IAM 使用者檢視您的帳單資訊和碳足跡報告允許 IAM 使用者存取 Reports (報告) 主控台頁面拒絕 IAM 使用者對 Billing and Cost Management 主控台的存取拒絕成員帳戶的 AWS 主控台成本和使用量 Widget 存取權拒絕特定 IAM 使用者和角色的 AWS 主控台成本和用量 Widget 存取權允許 IAM 使用者檢視您的帳單資訊,但拒絕存取碳足跡報告允許 IAM 使用者存取碳足跡報告,但拒絕存取帳單資訊允許完整存取 AWS 服務,但拒絕 IAM 使用者存取 Billing and Cost Management 主控台允許 IAM 使用者檢視 Billing and Cost Management 主控台,帳戶設定除外允許 IAM 使用者修改帳單資訊拒絕存取帳戶設定,但允許所有其他帳單和用量資訊的完整存取權將報告存入 Simple Storage Service (Amazon S3) 儲存貯體尋找產品和價格檢視成本和用量啟用和停用 AWS 區域檢視和管理成本類別建立、檢視、編輯或刪除 AWS 成本和用量報告檢視並管理採購訂單檢視和更新 Cost Explorer 偏好設定頁面使用 Cost Explorer 報告頁面檢視、建立、更新及刪除檢視、建立、更新及刪除保留和 Savings Plans 提醒允許 AWS 成本異常偵測的唯讀存取允許 AWS 預算套用 IAM 政策和 SCP允許 AWS 預算套用 IAM 政策和 SCP,以及目標 EC2 和 RDS 執行個體允許 IAM 使用者檢視美國免稅和建立 AWS Support 案例(適用於帳單或聯絡地址位於印度的客戶) 允許客戶驗證資訊的唯讀存取權(適用於在印度擁有帳單或聯絡地址的客戶) 檢視、建立和更新客戶驗證資訊在帳單主控台中檢視AWS Migration Acceleration Program資訊

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

AWS 帳單政策範例

注意

下列 AWS Identity and Access Management (IAM) 行動已於 2023 年 7 月終止標準支援:

  • aws-portal 命名空間

  • purchase-orders:ViewPurchaseOrders

  • purchase-orders:ModifyPurchaseOrders

如果您使用的是 AWS Organizations,您可以使用大量政策移轉程式指令碼或大量政策移轉工具來更新付款人帳戶中的政策。也可以使用舊動作至精細動作對應參考來確認需要新增的 IAM 動作。

如果您在 2023 年 3 月 6 日 AWS 帳戶,上午 11:00 (太平洋時間) 或之後 AWS Organizations 建立,或屬於建立的一部分,則細微動作已在您的組織中生效。

重要

本主題包含範例政策,您可以將它們連接至您的 IAM 使用者或群組,以控制對於您帳戶之帳單資訊和工具的存取。以下基本規則適用於 Billing and Cost Management 的 IAM 政策:

  • Version 始終是 2012-10-17

  • Effect 一律是 AllowDeny

  • Action 是動作或萬用字元的名稱 (*)。

    動作字首適用budgets於「 AWS 預算」、cur「 AWS 成本與用量報表」、aws-portal「 AWS 帳單」或 ce「Cost Explorer」。

  • Resource總是*用於 AWS 計費。

    針對在 budget 資源執行的動作,指定預算 Amazon Resource Name (ARN)。

  • 一個政策中可以有多個陳述式。

如需「 AWS 成本管理」主控台的動作政策清單,請參閱AWS 成本管理系統使用指南中的AWS 成本管理政策範例

主題

允許 IAM 使用者檢視您的帳單資訊

若要允許 IAM 使用者檢視您的帳單資訊,但不允許 IAM 使用者存取敏感的帳戶資訊,請使用類似以下範例政策的政策。這類政策可防止使用者存取您的密碼和帳戶活動報告。此政策允許 IAM 使用者檢視下列 Billing and Cost Management 主控台頁面,但不提供 Account Settings (帳戶設定) 或 Reports (報告) 主控台頁面的存取權給他們:

  • Dashboard (儀表板)

  • Cost Explorer

  • Bills (帳單)

  • Orders and invoices (訂單與發票)

  • Consolidated Billing (合併帳單)

  • Preferences (偏好設定)

  • Credits (點數)

  • Advance Payment (預付款)

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

允許 IAM 使用者檢視您的帳單資訊和碳足跡報告

若要允許 IAM 使用者檢視帳單資訊和碳足跡報告,請使用類似以下範例的政策。此政策可防止使用者存取您的密碼和帳戶活動報告。此政策允許 IAM 使用者檢視下列 Billing and Cost Management 主控台頁面,但不提供 Account Settings (帳戶設定) 或 Reports (報告) 主控台頁面的存取權給他們:

  • Dashboard (儀表板)

  • Cost Explorer

  • Bills (帳單)

  • Orders and invoices (訂單與發票)

  • Consolidated Billing (合併帳單)

  • Preferences (偏好設定)

  • Credits (點數)

  • Advance Payment (預付款)

  • 「 AWS 成本與用量報告」頁面的 AWS 客戶碳足跡工具區段

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

允許 IAM 使用者存取 Reports (報告) 主控台頁面

若要允許 IAM 使用者存取 Reports (報告) 主控台頁面以及檢視包含帳戶活動資訊的用量報告,請使用類似此範例政策的政策。

如需每個動作的定義,請參閱 AWS 帳單主控台動作

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "aws-portal:ViewUsage", "aws-portal:ViewBilling", "cur:DescribeReportDefinitions", "cur:PutReportDefinition", "cur:DeleteReportDefinition", "cur:ModifyReportDefinition" ], "Resource": "*" } ] }

拒絕 IAM 使用者對 Billing and Cost Management 主控台的存取

若要明確拒絕 IAM 使用者存取所有 Billing and Cost Management 主控台頁面,請使用類似此範例政策的政策。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "aws-portal:*", "Resource": "*" } ] }

拒絕成員帳戶的 AWS 主控台成本和使用量 Widget 存取權

若要限制成員 (已連結) 帳戶存取成本和用量資料,請使用管理 (付款人) 帳戶存取 Cost Explorer 偏好設定索引標籤,然後取消選取 Linked Account Access (連結帳戶存取)。這將拒絕從 Cost Explorer (成本管理) 主控台、Co AWS st Explorer API 和主控 AWS 台首頁的成本和用量小工具存取成本和用量資料,而不論成員帳戶的 IAM 使用者或角色具有哪些 IAM 動作。

拒絕特定 IAM 使用者和角色的 AWS 主控台成本和用量 Widget 存取權

若要拒絕特定 IAM 使用者和角色的 AWS 主控台成本和使用量 Widget 存取權,請使用以下許可政策。

注意

將此政策新增至 IAM 使用者或角色,也會拒絕使用者存取 Cost Explorer (AWS 成本管理) 主控台和 Cost Explorer API。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "ce:*", "Resource": "*" } ] }

允許 IAM 使用者檢視您的帳單資訊,但拒絕存取碳足跡報告

允許 IAM 使用者在 Billing and Cost Management 主控台中同時存取帳單資訊,但不允許存取 AWS 客戶碳足跡工具。此工具位於「 AWS 成本和使用量報告」頁面中。

{ "Version": "2012-10-17", "Statement": [ {"Effect": "Allow", "Action": "aws-portal:ViewBilling", "Resource": "*" }, {"Effect": "Deny", "Action": "sustainability:GetCarbonFootprintSummary", "Resource": "*" } ] }

允許 IAM 使用者存取碳足跡報告,但拒絕存取帳單資訊

允許 IAM 使用者存取「 AWS 成本和用量報告」頁面中的 AWS 客戶碳足跡工具,但拒絕存取 Billing and Cost Management 主控台中的帳單資訊。

{ "Version": "2012-10-17", "Statement": [ {"Effect": "Deny", "Action": "aws-portal:ViewBilling", "Resource": "*" }, {"Effect": "Allow", "Action": "sustainability:GetCarbonFootprintSummary", "Resource": "*" } ] }

允許完整存取 AWS 服務,但拒絕 IAM 使用者存取 Billing and Cost Management 主控台

若要拒絕 IAM 使用者存取 Billing and Cost Management 主控台的所有項目,請使用下列政策。拒絕使用者存取 AWS Identity and Access Management (IAM),以防止存取控制帳單資訊和工具存取權的政策。

重要

此政策不允許任何動作。將此政策與允許特定動作的其他政策結合使用。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": [ "aws-portal:*", "iam:*" ], "Resource": "*" } ] }

允許 IAM 使用者檢視 Billing and Cost Management 主控台,帳戶設定除外

此政策允許唯讀存取 Billing and Cost Management 主控台的全部功能。其中包括 Payments Method (付款方式)Reports (報告) 主控台頁面。不過,此政策拒絕存取 Account Settings (帳戶設定)。這表示會保護帳戶密碼、聯絡資訊和安全問題。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "aws-portal:View*", "Resource": "*" }, { "Effect": "Deny", "Action": "aws-portal:*Account", "Resource": "*" } ] }

允許 IAM 使用者修改帳單資訊

若要允許 IAM 使用者修改 Billing and Cost Management 主控台的帳戶帳單資訊,請允許 IAM 使用者檢視您的帳單資訊。下列政策範例允許 IAM 使用者修改 Consolidated Billing (合併帳單)、Preferences (偏好設定) 和 Credits (抵用金) 主控台頁面。同時允許 IAM 使用者檢視以下 Billing and Cost Management 主控台頁面:

  • Dashboard (儀表板)

  • Cost Explorer

  • Bills (帳單)

  • Orders and invoices (訂單與發票)

  • Advance Payment (預付款)

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

拒絕存取帳戶設定,但允許所有其他帳單和用量資訊的完整存取權

為了保護您的帳戶密碼、聯絡資訊和安全性問題,請拒絕 IAM 使用者存取帳戶設定,同時啟用 Billing and Cost Management 主控台其他功能的完整存取權。政策範例如下。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "aws-portal:*Billing", "aws-portal:*Usage", "aws-portal:*PaymentMethods" ], "Resource": "*" }, { "Effect": "Deny", "Action": "aws-portal:*Account", "Resource": "*" } ] }

將報告存入 Simple Storage Service (Amazon S3) 儲存貯體

如果您同時擁有該 AWS 帳戶和 Amazon S3 儲存貯體,則下列政策允許 Billing and Cost Management 將詳細 AWS 帳單儲存到 Amazon S3 儲存貯體。此政策必須套用到 Simple Storage Service (Amazon S3) 儲存貯體,而不是 IAM 使用者。因這是以資源為基礎的政策,而不是使用者為基礎的政策。對於不需要存取您帳單的 IAM 使用者,建議拒絕這些 IAM 使用者存取儲存貯體。

以您的儲存貯體名稱取代 DOC-EXAMPLE-BUCKET1

如需詳細資訊,請參閱 Amazon Simple Storage Service 使用者指南中的使用儲存貯體政策和使用者政策

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "billingreports.amazonaws.com" }, "Action": [ "s3:GetBucketAcl", "s3:GetBucketPolicy" ], "Resource": "arn:aws:s3:::DOC-EXAMPLE-BUCKET1" }, { "Effect": "Allow", "Principal": { "Service": "billingreports.amazonaws.com" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::DOC-EXAMPLE-BUCKET1/*" } ] }

尋找產品和價格

若要允許 IAM 使用者使用 AWS 價目表服務 API,請使用下列政策授予他們存取權。

此政策授與使用 AWS 價目表大量 API AWS 價目表查詢 API 的權限。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "pricing:DescribeServices", "pricing:GetAttributeValues", "pricing:GetProducts", "pricing:GetPriceListFileUrl", "pricing:ListPriceLists" ], "Resource": [ "*" ] } ] }

檢視成本和用量

若要允許 IAM 使用者使用 AWS Cost Explorer API,請使用下列政策授與他們存取權。

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

啟用和停用 AWS 區域

如需允許使用者啟用和停用區域的 IAM 政策範例,請參閱 IAM 使用者指南中的 AWS:允許啟用和停用 AWS 區域

檢視和管理成本類別

若要允許 IAM 使用者使用、檢視及管理成本類別,請使用下列政策為其授與存取權。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling", "ce:GetCostAndUsage", "ce:DescribeCostCategoryDefinition", "ce:UpdateCostCategoryDefinition", "ce:CreateCostCategoryDefinition", "ce:DeleteCostCategoryDefinition", "ce:ListCostCategoryDefinitions", "ce:TagResource", "ce:UntagResource", "ce:ListTagsForResource", "pricing:DescribeServices" ], "Resource": "*" } ] }

建立、檢視、編輯或刪除 AWS 成本和用量報告

此政策允許 IAM 使用者使用 API 建立、檢視、編輯或刪除 sample-report

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ManageSampleReport", "Effect": "Allow", "Action": [ "cur:PutReportDefinition", "cur:DeleteReportDefinition", "cur:ModifyReportDefinition" ], "Resource": "arn:aws:cur:*:123456789012:definition/sample-report" }, { "Sid": "DescribeReportDefs", "Effect": "Allow", "Action": "cur:DescribeReportDefinitions", "Resource": "*" } ] }

檢視並管理採購訂單

此政策允許 IAM 使用者檢視和管理採購訂單,使用下列政策授予存取權。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling", "purchase-orders:*" ], "Resource": "*" } ] }

檢視和更新 Cost Explorer 偏好設定頁面

此政策允許 IAM 使用者使用 Cost Explorer preferences page (Cost Explorer 偏好設定頁面) 進行檢視和更新。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling", "ce:UpdatePreferences" ], "Resource": "*" } ] }

下列政策允許 IAM 使用者檢視 Cost Explorer,但拒絕檢視或編輯 Preferences (偏好設定) 頁面的許可。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling" ], "Resource": "*" }, { "Sid": "VisualEditor1", "Effect": "Deny", "Action": [ "ce:GetPreferences", "ce:UpdatePreferences" ], "Resource": "*" } ] }

下列政策允許 IAM 使用者檢視 Cost Explorer,但拒絕編輯 Preferences (偏好設定) 頁面的許可。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling" ], "Resource": "*" }, { "Sid": "VisualEditor1", "Effect": "Deny", "Action": [ "ce:UpdatePreferences" ], "Resource": "*" } ] }

使用 Cost Explorer 報告頁面檢視、建立、更新及刪除

此政策允許 IAM 使用者使用 Cost Explorer reports page (Cost Explorer 報告頁面) 進行檢視、建立、更新和刪除。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling", "ce:CreateReport", "ce:UpdateReport", "ce:DeleteReport" ], "Resource": "*" } ] }

下列政策允許 IAM 使用者檢視 Cost Explorer,但拒絕檢視或編輯 Reports (報告) 頁面的許可。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling" ], "Resource": "*" }, { "Sid": "VisualEditor1", "Effect": "Deny", "Action": [ "ce:DescribeReport", "ce:CreateReport", "ce:UpdateReport", "ce:DeleteReport" ], "Resource": "*" } ] }

下列政策允許 IAM 使用者檢視 Cost Explorer,但拒絕編輯 Reports (報告) 頁面的許可。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling" ], "Resource": "*" }, { "Sid": "VisualEditor1", "Effect": "Deny", "Action": [ "ce:CreateReport", "ce:UpdateReport", "ce:DeleteReport" ], "Resource": "*" } ] }

檢視、建立、更新及刪除保留和 Savings Plans 提醒

此政策允許 IAM 使用者檢視、建立、更新及刪除保留過期提醒Savings Plans 提醒。若要編輯保留過期提醒或 Savings Plans 提醒,使用者需要全部三個精密動作:ce:CreateNotificationSubscriptionce:UpdateNotificationSubscription,以及 ce:DeleteNotificationSubscription

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling", "ce:CreateNotificationSubscription", "ce:UpdateNotificationSubscription", "ce:DeleteNotificationSubscription" ], "Resource": "*" } ] }

下列政策允許 IAM 使用者檢視 Cost Explorer,但拒絕檢視或編輯 Reservation Expiration Alerts (保留過期提醒) 和 Savings Plans alert (Savings Plans 提醒) 頁面的許可。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling" ], "Resource": "*" }, { "Sid": "VisualEditor1", "Effect": "Deny", "Action": [ "ce:DescribeNotificationSubscription", "ce:CreateNotificationSubscription", "ce:UpdateNotificationSubscription", "ce:DeleteNotificationSubscription" ], "Resource": "*" } ] }

下列政策允許 IAM 使用者檢視 Cost Explorer,但拒絕編輯 Reservation Expiration Alerts (保留過期提醒) 和 Savings Plans alert (Savings Plans 提醒) 頁面的許可。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling" ], "Resource": "*" }, { "Sid": "VisualEditor1", "Effect": "Deny", "Action": [ "ce:CreateNotificationSubscription", "ce:UpdateNotificationSubscription", "ce:DeleteNotificationSubscription" ], "Resource": "*" } ] }

允許 AWS 成本異常偵測的唯讀存取

若要允許 IAM 使用者唯讀存取「 AWS 成本異常偵測」,請使用下列政策授予他們存取權。 ce:ProvideAnomalyFeedback是可選的,作為唯讀存取的一部分。

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

允許 AWS 預算套用 IAM 政策和 SCP

此政策允許 AWS 預算代表使用者套用 IAM 政策和服務控制政策 (SCP)。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iam:AttachGroupPolicy", "iam:AttachRolePolicy", "iam:AttachUserPolicy", "iam:DetachGroupPolicy", "iam:DetachRolePolicy", "iam:DetachUserPolicy", "organizations:AttachPolicy", "organizations:DetachPolicy" ], "Resource": "*" } ] }

允許 AWS 預算套用 IAM 政策和 SCP,以及目標 EC2 和 RDS 執行個體

此政策允許 AWS 預算套用 IAM 政策和服務控制政策 (SCP),並代表使用者將 Amazon EC2 和 Amazon RDS 執行個體鎖定為目標。

信任政策

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

許可政策

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:DescribeInstanceStatus", "ec2:StartInstances", "ec2:StopInstances", "iam:AttachGroupPolicy", "iam:AttachRolePolicy", "iam:AttachUserPolicy", "iam:DetachGroupPolicy", "iam:DetachRolePolicy", "iam:DetachUserPolicy", "organizations:AttachPolicy", "organizations:DetachPolicy", "rds:DescribeDBInstances", "rds:StartDBInstance", "rds:StopDBInstance", "ssm:StartAutomationExecution" ], "Resource": "*" } ] }

允許 IAM 使用者檢視美國免稅和建立 AWS Support 案例

此政策允許 IAM 使用者檢視美國免稅,並建立 AWS Support 案例,以便在免稅主控台中上傳免稅憑證。

{ "Version": "2012-10-17", "Statement": [ { "Action": [ "aws-portal:*", "tax:GetExemptions", "tax:UpdateExemptions", "support:CreateCase", "support:AddAttachmentsToSet" ], "Resource": [ "*" ], "Effect": "Allow" } ] }

(適用於帳單或聯絡地址位於印度的客戶) 允許客戶驗證資訊的唯讀存取權

此政策允許 IAM 使用者唯讀存取客戶驗證資訊。

如需每個動作的定義,請參閱 AWS 帳單主控台動作

{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": [ "customer-verification:GetCustomerVerificationEligibility", "customer-verification:GetCustomerVerificationDetails" ], "Resource": "*" }] }

(適用於在印度擁有帳單或聯絡地址的客戶) 檢視、建立和更新客戶驗證資訊

此政策允許 IAM 使用者管理他們的客戶驗證資訊。

如需每個動作的定義,請參閱 AWS 帳單主控台動作

{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": [ "customer-verification:CreateCustomerVerificationDetails", "customer-verification:UpdateCustomerVerificationDetails", "customer-verification:GetCustomerVerificationEligibility", "customer-verification:GetCustomerVerificationDetails" ], "Resource": "*" }] }

在帳單主控台中檢視AWS Migration Acceleration Program資訊

此政策允許 IAM 使用者在帳單主控台中檢視付款人帳戶的Migration Acceleration Program協議、抵免額和合格支出。

如需每個動作的定義,請參閱 AWS 帳單主控台動作

{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": [ "mapcredit:ListQuarterSpend", "mapcredit:ListQuarterCredits", "mapcredit:ListAssociatedPrograms" ], "Resource": "*" }] }