@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
257 lines • 8.86 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Budget = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a budgets budget resource. Budgets use the cost visualization provided by Cost Explorer to show you the status of your budgets, to provide forecasts of your estimated costs, and to track your AWS usage, including your free tier usage.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const ec2 = new aws.budgets.Budget("ec2", {
* name: "budget-ec2-monthly",
* budgetType: "COST",
* limitAmount: "1200",
* limitUnit: "USD",
* timePeriodEnd: "2087-06-15_00:00",
* timePeriodStart: "2017-07-01_00:00",
* timeUnit: "MONTHLY",
* costFilters: [{
* name: "Service",
* values: ["Amazon Elastic Compute Cloud - Compute"],
* }],
* notifications: [{
* comparisonOperator: "GREATER_THAN",
* threshold: 100,
* thresholdType: "PERCENTAGE",
* notificationType: "FORECASTED",
* subscriberEmailAddresses: ["test@example.com"],
* }],
* tags: {
* Tag1: "Value1",
* Tag2: "Value2",
* },
* });
* ```
*
* Create a budget for *$100*.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const cost = new aws.budgets.Budget("cost", {
* budgetType: "COST",
* limitAmount: "100",
* limitUnit: "USD",
* });
* ```
*
* Create a budget with planned budget limits.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const cost = new aws.budgets.Budget("cost", {plannedLimits: [
* {
* startTime: "2017-07-01_00:00",
* amount: "100",
* unit: "USD",
* },
* {
* startTime: "2017-08-01_00:00",
* amount: "200",
* unit: "USD",
* },
* ]});
* ```
*
* Create a budget for s3 with a limit of *3 GB* of storage.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const s3 = new aws.budgets.Budget("s3", {
* budgetType: "USAGE",
* limitAmount: "3",
* limitUnit: "GB",
* });
* ```
*
* Create a Savings Plan Utilization Budget
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const savingsPlanUtilization = new aws.budgets.Budget("savings_plan_utilization", {
* budgetType: "SAVINGS_PLANS_UTILIZATION",
* limitAmount: "100.0",
* limitUnit: "PERCENTAGE",
* costTypes: {
* includeCredit: false,
* includeDiscount: false,
* includeOtherSubscription: false,
* includeRecurring: false,
* includeRefund: false,
* includeSubscription: true,
* includeSupport: false,
* includeTax: false,
* includeUpfront: false,
* useBlended: false,
* },
* });
* ```
*
* Create a RI Utilization Budget
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const riUtilization = new aws.budgets.Budget("ri_utilization", {
* budgetType: "RI_UTILIZATION",
* limitAmount: "100.0",
* limitUnit: "PERCENTAGE",
* costTypes: {
* includeCredit: false,
* includeDiscount: false,
* includeOtherSubscription: false,
* includeRecurring: false,
* includeRefund: false,
* includeSubscription: true,
* includeSupport: false,
* includeTax: false,
* includeUpfront: false,
* useBlended: false,
* },
* costFilters: [{
* name: "Service",
* values: ["Amazon Relational Database Service"],
* }],
* });
* ```
*
* Create a cost filter using resource tags
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const cost = new aws.budgets.Budget("cost", {costFilters: [{
* name: "TagKeyValue",
* values: [
* "aws:createdBy$Pulumi",
* "user:business-unit$human_resources",
* ],
* }]});
* ```
*
* Create a cost filter using resource tags, obtaining the tag value from a variable
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const cost = new aws.budgets.Budget("cost", {costFilters: [{
* name: "TagKeyValue",
* values: [`TagKey${"$"}${tagValue}`],
* }]});
* ```
*
* ## Import
*
* Using `pulumi import`, import budgets using `AccountID:BudgetName`. For example:
*
* ```sh
* $ pulumi import aws:budgets/budget:Budget myBudget 123456789012:myBudget
* ```
*/
class Budget extends pulumi.CustomResource {
/**
* Get an existing Budget resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Budget(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Budget. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Budget.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accountId"] = state?.accountId;
resourceInputs["arn"] = state?.arn;
resourceInputs["autoAdjustData"] = state?.autoAdjustData;
resourceInputs["budgetType"] = state?.budgetType;
resourceInputs["costFilters"] = state?.costFilters;
resourceInputs["costTypes"] = state?.costTypes;
resourceInputs["limitAmount"] = state?.limitAmount;
resourceInputs["limitUnit"] = state?.limitUnit;
resourceInputs["name"] = state?.name;
resourceInputs["namePrefix"] = state?.namePrefix;
resourceInputs["notifications"] = state?.notifications;
resourceInputs["plannedLimits"] = state?.plannedLimits;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["timePeriodEnd"] = state?.timePeriodEnd;
resourceInputs["timePeriodStart"] = state?.timePeriodStart;
resourceInputs["timeUnit"] = state?.timeUnit;
}
else {
const args = argsOrState;
if (args?.budgetType === undefined && !opts.urn) {
throw new Error("Missing required property 'budgetType'");
}
if (args?.timeUnit === undefined && !opts.urn) {
throw new Error("Missing required property 'timeUnit'");
}
resourceInputs["accountId"] = args?.accountId;
resourceInputs["autoAdjustData"] = args?.autoAdjustData;
resourceInputs["budgetType"] = args?.budgetType;
resourceInputs["costFilters"] = args?.costFilters;
resourceInputs["costTypes"] = args?.costTypes;
resourceInputs["limitAmount"] = args?.limitAmount;
resourceInputs["limitUnit"] = args?.limitUnit;
resourceInputs["name"] = args?.name;
resourceInputs["namePrefix"] = args?.namePrefix;
resourceInputs["notifications"] = args?.notifications;
resourceInputs["plannedLimits"] = args?.plannedLimits;
resourceInputs["tags"] = args?.tags;
resourceInputs["timePeriodEnd"] = args?.timePeriodEnd;
resourceInputs["timePeriodStart"] = args?.timePeriodStart;
resourceInputs["timeUnit"] = args?.timeUnit;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Budget.__pulumiType, name, resourceInputs, opts);
}
}
exports.Budget = Budget;
/** @internal */
Budget.__pulumiType = 'aws:budgets/budget:Budget';
//# sourceMappingURL=budget.js.map
;