1. Packages
  2. AWS
  3. API Docs
  4. savingsplans
  5. getSavingsPlan
AWS v7.19.0 published on Friday, Feb 6, 2026 by Pulumi
aws logo
AWS v7.19.0 published on Friday, Feb 6, 2026 by Pulumi

    Use this data source to get information on an existing AWS Savings Plan.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.savingsplans.getSavingsPlan({
        savingsPlanId: "sp-12345678901234567",
    });
    export const savingsPlanState = example.then(example => example.state);
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.savingsplans.get_savings_plan(savings_plan_id="sp-12345678901234567")
    pulumi.export("savingsPlanState", example.state)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/savingsplans"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := savingsplans.LookupSavingsPlan(ctx, &savingsplans.LookupSavingsPlanArgs{
    			SavingsPlanId: "sp-12345678901234567",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("savingsPlanState", example.State)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.SavingsPlans.GetSavingsPlan.Invoke(new()
        {
            SavingsPlanId = "sp-12345678901234567",
        });
    
        return new Dictionary<string, object?>
        {
            ["savingsPlanState"] = example.Apply(getSavingsPlanResult => getSavingsPlanResult.State),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.savingsplans.SavingsplansFunctions;
    import com.pulumi.aws.savingsplans.inputs.GetSavingsPlanArgs;
    import java.util.List;
    import java.util.ArrayList;
    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) {
            final var example = SavingsplansFunctions.getSavingsPlan(GetSavingsPlanArgs.builder()
                .savingsPlanId("sp-12345678901234567")
                .build());
    
            ctx.export("savingsPlanState", example.state());
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: aws:savingsplans:getSavingsPlan
          arguments:
            savingsPlanId: sp-12345678901234567
    outputs:
      savingsPlanState: ${example.state}
    

    Using getSavingsPlan

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSavingsPlan(args: GetSavingsPlanArgs, opts?: InvokeOptions): Promise<GetSavingsPlanResult>
    function getSavingsPlanOutput(args: GetSavingsPlanOutputArgs, opts?: InvokeOptions): Output<GetSavingsPlanResult>
    def get_savings_plan(savings_plan_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetSavingsPlanResult
    def get_savings_plan_output(savings_plan_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetSavingsPlanResult]
    func LookupSavingsPlan(ctx *Context, args *LookupSavingsPlanArgs, opts ...InvokeOption) (*LookupSavingsPlanResult, error)
    func LookupSavingsPlanOutput(ctx *Context, args *LookupSavingsPlanOutputArgs, opts ...InvokeOption) LookupSavingsPlanResultOutput

    > Note: This function is named LookupSavingsPlan in the Go SDK.

    public static class GetSavingsPlan 
    {
        public static Task<GetSavingsPlanResult> InvokeAsync(GetSavingsPlanArgs args, InvokeOptions? opts = null)
        public static Output<GetSavingsPlanResult> Invoke(GetSavingsPlanInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSavingsPlanResult> getSavingsPlan(GetSavingsPlanArgs args, InvokeOptions options)
    public static Output<GetSavingsPlanResult> getSavingsPlan(GetSavingsPlanArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aws:savingsplans/getSavingsPlan:getSavingsPlan
      arguments:
        # arguments dictionary

    The following arguments are supported:

    SavingsPlanId string
    The ID of the Savings Plan.
    SavingsPlanId string
    The ID of the Savings Plan.
    savingsPlanId String
    The ID of the Savings Plan.
    savingsPlanId string
    The ID of the Savings Plan.
    savings_plan_id str
    The ID of the Savings Plan.
    savingsPlanId String
    The ID of the Savings Plan.

    getSavingsPlan Result

    The following output properties are available:

    Commitment string
    The hourly commitment amount.
    Currency string
    The currency of the Savings Plan.
    Description string
    Ec2InstanceFamily string
    The EC2 instance family for the Savings Plan.
    End string
    The end time of the Savings Plan.
    Id string
    The provider-assigned unique ID for this managed resource.
    OfferingId string
    The ID of the offering.
    PaymentOption string
    The payment option for the Savings Plan.
    ProductTypes List<string>
    PurchaseTime string
    RecurringPaymentAmount string
    The recurring payment amount.
    Region string
    The AWS Region.
    ReturnableUntil string
    SavingsPlanArn string
    The ARN of the Savings Plan.
    SavingsPlanId string
    SavingsPlanOfferingId string
    SavingsPlanType string
    The type of Savings Plan.
    Start string
    The start time of the Savings Plan.
    State string
    The current state of the Savings Plan.
    Tags Dictionary<string, string>
    A map of tags assigned to the resource.
    TermDurationInSeconds int
    The duration of the term, in seconds.
    UpfrontPaymentAmount string
    The up-front payment amount.
    Commitment string
    The hourly commitment amount.
    Currency string
    The currency of the Savings Plan.
    Description string
    Ec2InstanceFamily string
    The EC2 instance family for the Savings Plan.
    End string
    The end time of the Savings Plan.
    Id string
    The provider-assigned unique ID for this managed resource.
    OfferingId string
    The ID of the offering.
    PaymentOption string
    The payment option for the Savings Plan.
    ProductTypes []string
    PurchaseTime string
    RecurringPaymentAmount string
    The recurring payment amount.
    Region string
    The AWS Region.
    ReturnableUntil string
    SavingsPlanArn string
    The ARN of the Savings Plan.
    SavingsPlanId string
    SavingsPlanOfferingId string
    SavingsPlanType string
    The type of Savings Plan.
    Start string
    The start time of the Savings Plan.
    State string
    The current state of the Savings Plan.
    Tags map[string]string
    A map of tags assigned to the resource.
    TermDurationInSeconds int
    The duration of the term, in seconds.
    UpfrontPaymentAmount string
    The up-front payment amount.
    commitment String
    The hourly commitment amount.
    currency String
    The currency of the Savings Plan.
    description String
    ec2InstanceFamily String
    The EC2 instance family for the Savings Plan.
    end String
    The end time of the Savings Plan.
    id String
    The provider-assigned unique ID for this managed resource.
    offeringId String
    The ID of the offering.
    paymentOption String
    The payment option for the Savings Plan.
    productTypes List<String>
    purchaseTime String
    recurringPaymentAmount String
    The recurring payment amount.
    region String
    The AWS Region.
    returnableUntil String
    savingsPlanArn String
    The ARN of the Savings Plan.
    savingsPlanId String
    savingsPlanOfferingId String
    savingsPlanType String
    The type of Savings Plan.
    start String
    The start time of the Savings Plan.
    state String
    The current state of the Savings Plan.
    tags Map<String,String>
    A map of tags assigned to the resource.
    termDurationInSeconds Integer
    The duration of the term, in seconds.
    upfrontPaymentAmount String
    The up-front payment amount.
    commitment string
    The hourly commitment amount.
    currency string
    The currency of the Savings Plan.
    description string
    ec2InstanceFamily string
    The EC2 instance family for the Savings Plan.
    end string
    The end time of the Savings Plan.
    id string
    The provider-assigned unique ID for this managed resource.
    offeringId string
    The ID of the offering.
    paymentOption string
    The payment option for the Savings Plan.
    productTypes string[]
    purchaseTime string
    recurringPaymentAmount string
    The recurring payment amount.
    region string
    The AWS Region.
    returnableUntil string
    savingsPlanArn string
    The ARN of the Savings Plan.
    savingsPlanId string
    savingsPlanOfferingId string
    savingsPlanType string
    The type of Savings Plan.
    start string
    The start time of the Savings Plan.
    state string
    The current state of the Savings Plan.
    tags {[key: string]: string}
    A map of tags assigned to the resource.
    termDurationInSeconds number
    The duration of the term, in seconds.
    upfrontPaymentAmount string
    The up-front payment amount.
    commitment str
    The hourly commitment amount.
    currency str
    The currency of the Savings Plan.
    description str
    ec2_instance_family str
    The EC2 instance family for the Savings Plan.
    end str
    The end time of the Savings Plan.
    id str
    The provider-assigned unique ID for this managed resource.
    offering_id str
    The ID of the offering.
    payment_option str
    The payment option for the Savings Plan.
    product_types Sequence[str]
    purchase_time str
    recurring_payment_amount str
    The recurring payment amount.
    region str
    The AWS Region.
    returnable_until str
    savings_plan_arn str
    The ARN of the Savings Plan.
    savings_plan_id str
    savings_plan_offering_id str
    savings_plan_type str
    The type of Savings Plan.
    start str
    The start time of the Savings Plan.
    state str
    The current state of the Savings Plan.
    tags Mapping[str, str]
    A map of tags assigned to the resource.
    term_duration_in_seconds int
    The duration of the term, in seconds.
    upfront_payment_amount str
    The up-front payment amount.
    commitment String
    The hourly commitment amount.
    currency String
    The currency of the Savings Plan.
    description String
    ec2InstanceFamily String
    The EC2 instance family for the Savings Plan.
    end String
    The end time of the Savings Plan.
    id String
    The provider-assigned unique ID for this managed resource.
    offeringId String
    The ID of the offering.
    paymentOption String
    The payment option for the Savings Plan.
    productTypes List<String>
    purchaseTime String
    recurringPaymentAmount String
    The recurring payment amount.
    region String
    The AWS Region.
    returnableUntil String
    savingsPlanArn String
    The ARN of the Savings Plan.
    savingsPlanId String
    savingsPlanOfferingId String
    savingsPlanType String
    The type of Savings Plan.
    start String
    The start time of the Savings Plan.
    state String
    The current state of the Savings Plan.
    tags Map<String>
    A map of tags assigned to the resource.
    termDurationInSeconds Number
    The duration of the term, in seconds.
    upfrontPaymentAmount String
    The up-front payment amount.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v7.19.0 published on Friday, Feb 6, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate