AWS Budgets examples using Tools for PowerShell - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

AWS Budgets examples using Tools for PowerShell

The following code examples show you how to perform actions and implement common scenarios by using the AWS Tools for PowerShell with AWS Budgets.

Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.

Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.

Topics

Actions

The following code example shows how to use New-BGTBudget.

Tools for PowerShell

Example 1: Creates a new budget with the specified budgetary and time constraints with email notifications.

$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
  • For API details, see CreateBudget in AWS Tools for PowerShell Cmdlet Reference.