AWS Budgets examples using Tools for PowerShell V5 - AWS Tools for PowerShell (version 5)

Version 5 (V5) of the AWS Tools for PowerShell has been released!

For information about breaking changes and migrating your applications, see the migration topic.

AWS Budgets examples using Tools for PowerShell V5

The following code examples show you how to perform actions and implement common scenarios by using the AWS Tools for PowerShell V5 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 V5

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 (V5).