本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
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 AM (PDT) 或之後 AWS Organizations 建立,或屬於建立的一部分,則細微動作已在您的組織中生效。
重要
-
這些政策要求您必須在 [帳戶設定] 主控台頁面上啟IAM用使用者存取 [帳 Billing and Cost Management]
主控台。如需詳細資訊,請參閱 啟用 Billing and Cost Management 主控台的存取權。 -
若要使用 AWS 受管理的策略,請參閱AWS 受管理政策。
本主題包含範例政策,您可以附加至IAM使用者或群組,以控制帳戶帳單資訊和工具的存取權限。下列基本規則適用於 Billing and Cost Management IAM 政策:
-
Version
始終是2012-10-17
。 -
Effect
一律是Allow
或Deny
。 -
Action
是動作或萬用字元的名稱 (*
)。動作字首適用
budgets
於「 AWS 預算」、cur
「 AWS 成本與用量報表」、aws-portal
「 AWS 帳單」或ce
「Cost Explorer」。 -
Resource
總是*
用於 AWS 計費。對於在
budget
資源上執行的動作,請指定預算 Amazon 資源名稱 (ARN)。 -
一個政策中可以有多個陳述式。
如需「 AWS 成本管理」主控台的動作政策清單,請參閱AWS 成本管理系統使用指南中的AWS 成本管理政策範例。
主題
- 允許IAM使用者檢視您的帳單資訊
- 允許IAM用戶查看您的帳單信息和碳足跡報告
- 允許IAM使用者存取報告主控台頁面
- 拒絕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原則和 SCPs
- 允許 AWS 預算套用IAM原則,以及鎖定SCPsEC2和RDS執行個體
- 允許IAM使用者檢視美國免稅額並建立 AWS Support 案例
- (適用於帳單或聯絡地址位於印度的客戶) 允許客戶驗證資訊的唯讀存取權
- (適用於在印度擁有帳單或聯絡地址的客戶) 檢視、建立和更新客戶驗證資訊
- 在帳單主控台中檢視AWS Migration Acceleration Program資訊
允許IAM使用者檢視您的帳單資訊
若要允許使用IAM者在不讓使用者存取敏感帳戶資訊的IAM情況下檢視您的帳單資訊,請使用類似下列範例政策的政策。這類政策可防止使用者存取您的密碼和帳戶活動報告。此原則可讓IAM使用者檢視下列 [Billing and Cost Management] 主控台頁面,而不會授予他們 [帳戶設定] 或 [報告] 主控台頁面的存取權:
-
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] 主控台頁面,而不會授予他們 [帳戶設定] 或 [報告] 主控台頁面的存取權:
-
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使用者存取報告主控台頁面
若要允許使用IAM者存取「報告」主控台頁面並檢視包含帳戶活動資訊的使用情況報告,請使用類似於此範例策略的策略。
如需每個動作的定義,請參閱 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 (AWS 成本管理) 主控台、Cost Explorer 和主控 AWS 台首頁的成本和使用量小器具存取成本和使用量資料API,而不論成員帳戶的使用IAM者或角色執行何種IAM動作。
拒絕特定使用IAM者和角色的 AWS 主控台成本和使用量 Widget 存取權
若要拒絕特定使用IAM者和角色的 AWS 主控台成本和使用量 Widget 存取權,請使用下列權限原則。
注意
將此原則新增至IAM使用者或角色,也會拒絕使用者存取 Cost Explorer (AWS 成本管理) 主控台和 Cost Explorer APIs。
{ "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使用者在 [帳單與成本管理] 主控台中修改帳戶帳單資訊,請允許IAM使用者檢視您的帳單資訊。下列政策範例可讓IAM使用者修改合併帳單、喜好設定和抵免額主控台頁面。它也可讓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 儲存貯體。此政策必須套用至 Amazon S3 儲存貯體,而不是IAM使用者。因這是以資源為基礎的政策,而不是使用者為基礎的政策。我們建議您拒絕不需要存取帳單的使IAM用IAM者存取值區的使用者存取權。
Replace (取代) 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 ExplorerAPI,請使用下列原則授與他們存取權。
{ "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 成本和用量報告
此原則允許sample-report
使用IAM者使用建立、檢視、編輯或刪除API。
{ "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」偏好設定頁面來檢視及更新。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling", "ce:UpdatePreferences" ], "Resource": "*" } ] }
下列原則可讓IAM使用者檢視 Cost Explorer,但拒絕檢視或編輯「偏好設定」頁面的權限。
{ "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,但拒絕編輯「偏好設定」頁面的權限。
{ "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」報告頁面來檢視、建立、更新及刪除。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "aws-portal:ViewBilling", "ce:CreateReport", "ce:UpdateReport", "ce:DeleteReport" ], "Resource": "*" } ] }
下列原則可讓IAM使用者檢視 Cost Explorer,但拒絕檢視或編輯 [報告] 頁面的權限。
{ "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,但拒絕編輯 [報告] 頁面的權限。
{ "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使用者檢視、建立、更新和刪除保留區到期警示和 S avings Plans 警示。若要編輯保留過期提醒或 Savings Plans 提醒,使用者需要全部三個精密動作:ce:CreateNotificationSubscription
、ce: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,但拒絕檢視或編輯保留區到期警示和 S avings Plan s 警示頁面的權限。
{ "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,但拒絕編輯保留區到期警示和 S avings Plan s 警示頁面的權限。
{ "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原則和 SCPs
此原則允許 AWS 預算代表使用者套用原IAM則和服務控制原則 (SCPs)。
{ "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原則,以及鎖定SCPsEC2和RDS執行個體
此政策允許 AWS 預算套用政IAM策和服務控制政策 (SCPs),並代表使用者鎖定 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": "*" }] }