または AWS SDK CreateBudgetで使用する CLI - AWS SDK コード例

AWS Doc SDK Examples GitHub リポジトリには他にも AWS SDK例があります。

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

または AWS SDK CreateBudgetで使用する CLI

以下のコード例は、CreateBudget の使用方法を示しています。

CLI
AWS CLI

コストと使用状況の予算を作成するには

次のcreate-budgetコマンドは、コストと使用状況の予算を作成します。

aws budgets create-budget \ --account-id 111122223333 \ --budget file://budget.json \ --notifications-with-subscribers file://notifications-with-subscribers.json

budget.json の内容:

{ "BudgetLimit": { "Amount": "100", "Unit": "USD" }, "BudgetName": "Example Tag Budget", "BudgetType": "COST", "CostFilters": { "TagKeyValue": [ "user:Key$value1", "user:Key$value2" ] }, "CostTypes": { "IncludeCredit": true, "IncludeDiscount": true, "IncludeOtherSubscription": true, "IncludeRecurring": true, "IncludeRefund": true, "IncludeSubscription": true, "IncludeSupport": true, "IncludeTax": true, "IncludeUpfront": true, "UseBlended": false }, "TimePeriod": { "Start": 1477958399, "End": 3706473600 }, "TimeUnit": "MONTHLY" }

notifications-with-subscribers.json の内容:

[ { "Notification": { "ComparisonOperator": "GREATER_THAN", "NotificationType": "ACTUAL", "Threshold": 80, "ThresholdType": "PERCENTAGE" }, "Subscribers": [ { "Address": "example@example.com", "SubscriptionType": "EMAIL" } ] } ]
  • API 詳細については、AWS CLI 「 コマンドリファレンスCreateBudget」の「」を参照してください。

PowerShell
のツール PowerShell

例 1: E メール通知を使用して、指定された予算と時間の制約を持つ新しい予算を作成します。

$notification = @{ NotificationType = "ACTUAL" ComparisonOperator = "GREATER_THAN" Threshold = 80 } $addressObject = @{ Address = @("user@domain.com") SubscriptionType = "EMAIL" } $subscriber = New-Object Amazon.Budgets.Model.NotificationWithSubscribers $subscriber.Notification = $notification $subscriber.Subscribers.Add($addressObject) $startDate = [datetime]::new(2017,09,25) $endDate = [datetime]::new(2017,10,25) New-BGTBudget -Budget_BudgetName "Tester" -Budget_BudgetType COST -CostTypes_IncludeTax $true -Budget_TimeUnit MONTHLY -BudgetLimit_Unit USD -TimePeriod_Start $startDate -TimePeriod_End $endDate -AccountId 123456789012 -BudgetLimit_Amount 200 -NotificationsWithSubscriber $subscriber
  • API 詳細については、「 コマンドレットリファレンスCreateBudget」の「」を参照してください。 AWS Tools for PowerShell