Package com.pulumi.aws.savingsplans
Class SavingsPlan
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.savingsplans.SavingsPlan
-
public class SavingsPlan extends com.pulumi.resources.CustomResourceProvides an AWS Savings Plan resource. > Savings Plans represent a financial commitment. Once a Savings Plan becomes active, it **cannot be cancelled or deleted**. Only Savings Plans in the `queued` state (scheduled for future purchase) can be deleted. Use this resource with caution. > Importing an active Savings Plan will add it to your Terraform state, but destroying it will only remove it from state - the actual Savings Plan will continue until its term ends. ## Example Usage ### Basic Usage
### Scheduled Purchasepackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.savingsplans.SavingsPlan; import com.pulumi.aws.savingsplans.SavingsPlanArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new SavingsPlan("example", SavingsPlanArgs.builder() .savingsPlanOfferingId("00000000-0000-0000-0000-000000000000") .commitment("1.0") .tags(Map.of("Environment", "production")) .build()); } }
## Import Using `pulumi import`, import Savings Plans using the `id`. For example: Using `terraform state mv`, import Savings Plans using the `id`. For example: ```sh $ pulumi import aws:savingsplans/savingsPlan:SavingsPlan example sp-12345678901234567 ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.savingsplans.SavingsPlan; import com.pulumi.aws.savingsplans.SavingsPlanArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var scheduled = new SavingsPlan("scheduled", SavingsPlanArgs.builder() .savingsPlanOfferingId("00000000-0000-0000-0000-000000000000") .commitment("5.0") .purchaseTime("2026-12-01T00:00:00Z") .tags(Map.of("Environment", "production")) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description SavingsPlan(java.lang.String name)SavingsPlan(java.lang.String name, SavingsPlanArgs args)SavingsPlan(java.lang.String name, SavingsPlanArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>commitment()com.pulumi.core.Output<java.lang.String>currency()com.pulumi.core.Output<java.lang.String>description()com.pulumi.core.Output<java.lang.String>ec2InstanceFamily()com.pulumi.core.Output<java.lang.String>end()static SavingsPlanget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, SavingsPlanState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>offeringId()com.pulumi.core.Output<java.lang.String>paymentOption()com.pulumi.core.Output<java.util.List<java.lang.String>>productTypes()com.pulumi.core.Output<java.lang.String>purchaseTime()com.pulumi.core.Output<java.lang.String>recurringPaymentAmount()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>returnableUntil()com.pulumi.core.Output<java.lang.String>savingsPlanArn()com.pulumi.core.Output<java.lang.String>savingsPlanId()com.pulumi.core.Output<java.lang.String>savingsPlanOfferingId()com.pulumi.core.Output<java.lang.String>savingsPlanType()com.pulumi.core.Output<java.lang.String>start()com.pulumi.core.Output<java.lang.String>state()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()com.pulumi.core.Output<java.lang.Integer>termDurationInSeconds()com.pulumi.core.Output<java.util.Optional<SavingsPlanTimeouts>>timeouts()com.pulumi.core.Output<java.lang.String>upfrontPaymentAmount()
-
-
-
Constructor Detail
-
SavingsPlan
public SavingsPlan(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
SavingsPlan
public SavingsPlan(java.lang.String name, SavingsPlanArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
SavingsPlan
public SavingsPlan(java.lang.String name, SavingsPlanArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
commitment
public com.pulumi.core.Output<java.lang.String> commitment()
- Returns:
- The hourly commitment, in USD. This is the amount you commit to pay per hour, regardless of actual usage. The following arguments are optional:
-
currency
public com.pulumi.core.Output<java.lang.String> currency()
- Returns:
- The currency of the Savings Plan (e.g., `USD`).
-
description
public com.pulumi.core.Output<java.lang.String> description()
- Returns:
- The description.
-
ec2InstanceFamily
public com.pulumi.core.Output<java.lang.String> ec2InstanceFamily()
- Returns:
- The EC2 instance family for the Savings Plan (only applicable to EC2 Instance Savings Plans).
-
end
public com.pulumi.core.Output<java.lang.String> end()
- Returns:
- The end time of the Savings Plan in RFC3339 format.
-
offeringId
public com.pulumi.core.Output<java.lang.String> offeringId()
- Returns:
- The ID of the offering.
-
paymentOption
public com.pulumi.core.Output<java.lang.String> paymentOption()
- Returns:
- The payment option for the Savings Plan (e.g., `All Upfront`, `Partial Upfront`, `No Upfront`).
-
productTypes
public com.pulumi.core.Output<java.util.List<java.lang.String>> productTypes()
- Returns:
- The product types.
-
purchaseTime
public com.pulumi.core.Output<java.lang.String> purchaseTime()
- Returns:
- The time at which to purchase the Savings Plan, in UTC format (`YYYY-MM-DDTHH:MM:SSZ`). If not specified, the plan is purchased immediately. Plans with a future purchase time are placed in `queued` state and can be deleted before they become active.
-
recurringPaymentAmount
public com.pulumi.core.Output<java.lang.String> recurringPaymentAmount()
- Returns:
- The recurring payment amount.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- The AWS Region.
-
returnableUntil
public com.pulumi.core.Output<java.lang.String> returnableUntil()
- Returns:
- The recurring payment amount.
-
savingsPlanArn
public com.pulumi.core.Output<java.lang.String> savingsPlanArn()
- Returns:
- The ARN of the Savings Plan.
-
savingsPlanId
public com.pulumi.core.Output<java.lang.String> savingsPlanId()
- Returns:
- The ID of the Savings Plan.
-
savingsPlanOfferingId
public com.pulumi.core.Output<java.lang.String> savingsPlanOfferingId()
- Returns:
- The unique ID of a Savings Plan offering. You can find available offerings using the `aws savingsplans describe-savings-plans-offerings` CLI command.
-
savingsPlanType
public com.pulumi.core.Output<java.lang.String> savingsPlanType()
- Returns:
- The type of Savings Plan (e.g., `Compute`, `EC2Instance`).
-
start
public com.pulumi.core.Output<java.lang.String> start()
- Returns:
- The start time of the Savings Plan in RFC3339 format.
-
state
public com.pulumi.core.Output<java.lang.String> state()
- Returns:
- The current state of the Savings Plan (e.g., `active`, `queued`, `retired`).
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
termDurationInSeconds
public com.pulumi.core.Output<java.lang.Integer> termDurationInSeconds()
- Returns:
- The duration of the term, in seconds.
-
timeouts
public com.pulumi.core.Output<java.util.Optional<SavingsPlanTimeouts>> timeouts()
-
upfrontPaymentAmount
public com.pulumi.core.Output<java.lang.String> upfrontPaymentAmount()
- Returns:
- The up-front payment amount. Required for offerings with an `All Upfront` or `Partial Upfront` payment option. Must be omitted for `No Upfront` offerings.
-
get
public static SavingsPlan get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable SavingsPlanState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-