1. Packages
  2. AWS Classic
  3. API Docs
  4. pricing
  5. getProduct

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.pricing.getProduct

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Use this data source to get the pricing information of all products in AWS. This data source is only available in a us-east-1 or ap-south-1 provider.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.pricing.getProduct({
        serviceCode: "AmazonEC2",
        filters: [
            {
                field: "instanceType",
                value: "c5.xlarge",
            },
            {
                field: "operatingSystem",
                value: "Linux",
            },
            {
                field: "location",
                value: "US East (N. Virginia)",
            },
            {
                field: "preInstalledSw",
                value: "NA",
            },
            {
                field: "licenseModel",
                value: "No License required",
            },
            {
                field: "tenancy",
                value: "Shared",
            },
            {
                field: "capacitystatus",
                value: "Used",
            },
        ],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.pricing.get_product(service_code="AmazonEC2",
        filters=[
            {
                "field": "instanceType",
                "value": "c5.xlarge",
            },
            {
                "field": "operatingSystem",
                "value": "Linux",
            },
            {
                "field": "location",
                "value": "US East (N. Virginia)",
            },
            {
                "field": "preInstalledSw",
                "value": "NA",
            },
            {
                "field": "licenseModel",
                "value": "No License required",
            },
            {
                "field": "tenancy",
                "value": "Shared",
            },
            {
                "field": "capacitystatus",
                "value": "Used",
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/pricing"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := pricing.GetProduct(ctx, &pricing.GetProductArgs{
    			ServiceCode: "AmazonEC2",
    			Filters: []pricing.GetProductFilter{
    				{
    					Field: "instanceType",
    					Value: "c5.xlarge",
    				},
    				{
    					Field: "operatingSystem",
    					Value: "Linux",
    				},
    				{
    					Field: "location",
    					Value: "US East (N. Virginia)",
    				},
    				{
    					Field: "preInstalledSw",
    					Value: "NA",
    				},
    				{
    					Field: "licenseModel",
    					Value: "No License required",
    				},
    				{
    					Field: "tenancy",
    					Value: "Shared",
    				},
    				{
    					Field: "capacitystatus",
    					Value: "Used",
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Pricing.GetProduct.Invoke(new()
        {
            ServiceCode = "AmazonEC2",
            Filters = new[]
            {
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "instanceType",
                    Value = "c5.xlarge",
                },
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "operatingSystem",
                    Value = "Linux",
                },
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "location",
                    Value = "US East (N. Virginia)",
                },
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "preInstalledSw",
                    Value = "NA",
                },
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "licenseModel",
                    Value = "No License required",
                },
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "tenancy",
                    Value = "Shared",
                },
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "capacitystatus",
                    Value = "Used",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.pricing.PricingFunctions;
    import com.pulumi.aws.pricing.inputs.GetProductArgs;
    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 = PricingFunctions.getProduct(GetProductArgs.builder()
                .serviceCode("AmazonEC2")
                .filters(            
                    GetProductFilterArgs.builder()
                        .field("instanceType")
                        .value("c5.xlarge")
                        .build(),
                    GetProductFilterArgs.builder()
                        .field("operatingSystem")
                        .value("Linux")
                        .build(),
                    GetProductFilterArgs.builder()
                        .field("location")
                        .value("US East (N. Virginia)")
                        .build(),
                    GetProductFilterArgs.builder()
                        .field("preInstalledSw")
                        .value("NA")
                        .build(),
                    GetProductFilterArgs.builder()
                        .field("licenseModel")
                        .value("No License required")
                        .build(),
                    GetProductFilterArgs.builder()
                        .field("tenancy")
                        .value("Shared")
                        .build(),
                    GetProductFilterArgs.builder()
                        .field("capacitystatus")
                        .value("Used")
                        .build())
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:pricing:getProduct
          Arguments:
            serviceCode: AmazonEC2
            filters:
              - field: instanceType
                value: c5.xlarge
              - field: operatingSystem
                value: Linux
              - field: location
                value: US East (N. Virginia)
              - field: preInstalledSw
                value: NA
              - field: licenseModel
                value: No License required
              - field: tenancy
                value: Shared
              - field: capacitystatus
                value: Used
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.pricing.getProduct({
        serviceCode: "AmazonRedshift",
        filters: [
            {
                field: "instanceType",
                value: "ds1.xlarge",
            },
            {
                field: "location",
                value: "US East (N. Virginia)",
            },
        ],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.pricing.get_product(service_code="AmazonRedshift",
        filters=[
            {
                "field": "instanceType",
                "value": "ds1.xlarge",
            },
            {
                "field": "location",
                "value": "US East (N. Virginia)",
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/pricing"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := pricing.GetProduct(ctx, &pricing.GetProductArgs{
    			ServiceCode: "AmazonRedshift",
    			Filters: []pricing.GetProductFilter{
    				{
    					Field: "instanceType",
    					Value: "ds1.xlarge",
    				},
    				{
    					Field: "location",
    					Value: "US East (N. Virginia)",
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Pricing.GetProduct.Invoke(new()
        {
            ServiceCode = "AmazonRedshift",
            Filters = new[]
            {
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "instanceType",
                    Value = "ds1.xlarge",
                },
                new Aws.Pricing.Inputs.GetProductFilterInputArgs
                {
                    Field = "location",
                    Value = "US East (N. Virginia)",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.pricing.PricingFunctions;
    import com.pulumi.aws.pricing.inputs.GetProductArgs;
    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 = PricingFunctions.getProduct(GetProductArgs.builder()
                .serviceCode("AmazonRedshift")
                .filters(            
                    GetProductFilterArgs.builder()
                        .field("instanceType")
                        .value("ds1.xlarge")
                        .build(),
                    GetProductFilterArgs.builder()
                        .field("location")
                        .value("US East (N. Virginia)")
                        .build())
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:pricing:getProduct
          Arguments:
            serviceCode: AmazonRedshift
            filters:
              - field: instanceType
                value: ds1.xlarge
              - field: location
                value: US East (N. Virginia)
    

    Using getProduct

    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 getProduct(args: GetProductArgs, opts?: InvokeOptions): Promise<GetProductResult>
    function getProductOutput(args: GetProductOutputArgs, opts?: InvokeOptions): Output<GetProductResult>
    def get_product(filters: Optional[Sequence[GetProductFilter]] = None,
                    service_code: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetProductResult
    def get_product_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetProductFilterArgs]]]] = None,
                    service_code: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetProductResult]
    func GetProduct(ctx *Context, args *GetProductArgs, opts ...InvokeOption) (*GetProductResult, error)
    func GetProductOutput(ctx *Context, args *GetProductOutputArgs, opts ...InvokeOption) GetProductResultOutput

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

    public static class GetProduct 
    {
        public static Task<GetProductResult> InvokeAsync(GetProductArgs args, InvokeOptions? opts = null)
        public static Output<GetProductResult> Invoke(GetProductInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetProductResult> getProduct(GetProductArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:pricing/getProduct:getProduct
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetProductFilter>
    List of filters. Passed directly to the API (see GetProducts API reference). These filters must describe a single product, this resource will fail if more than one product is returned by the API.
    ServiceCode string
    Code of the service. Available service codes can be fetched using the DescribeServices pricing API call.
    Filters []GetProductFilter
    List of filters. Passed directly to the API (see GetProducts API reference). These filters must describe a single product, this resource will fail if more than one product is returned by the API.
    ServiceCode string
    Code of the service. Available service codes can be fetched using the DescribeServices pricing API call.
    filters List<GetProductFilter>
    List of filters. Passed directly to the API (see GetProducts API reference). These filters must describe a single product, this resource will fail if more than one product is returned by the API.
    serviceCode String
    Code of the service. Available service codes can be fetched using the DescribeServices pricing API call.
    filters GetProductFilter[]
    List of filters. Passed directly to the API (see GetProducts API reference). These filters must describe a single product, this resource will fail if more than one product is returned by the API.
    serviceCode string
    Code of the service. Available service codes can be fetched using the DescribeServices pricing API call.
    filters Sequence[GetProductFilter]
    List of filters. Passed directly to the API (see GetProducts API reference). These filters must describe a single product, this resource will fail if more than one product is returned by the API.
    service_code str
    Code of the service. Available service codes can be fetched using the DescribeServices pricing API call.
    filters List<Property Map>
    List of filters. Passed directly to the API (see GetProducts API reference). These filters must describe a single product, this resource will fail if more than one product is returned by the API.
    serviceCode String
    Code of the service. Available service codes can be fetched using the DescribeServices pricing API call.

    getProduct Result

    The following output properties are available:

    Filters List<GetProductFilter>
    Id string
    The provider-assigned unique ID for this managed resource.
    Result string
    Set to the product returned from the API.
    ServiceCode string
    Filters []GetProductFilter
    Id string
    The provider-assigned unique ID for this managed resource.
    Result string
    Set to the product returned from the API.
    ServiceCode string
    filters List<GetProductFilter>
    id String
    The provider-assigned unique ID for this managed resource.
    result String
    Set to the product returned from the API.
    serviceCode String
    filters GetProductFilter[]
    id string
    The provider-assigned unique ID for this managed resource.
    result string
    Set to the product returned from the API.
    serviceCode string
    filters Sequence[GetProductFilter]
    id str
    The provider-assigned unique ID for this managed resource.
    result str
    Set to the product returned from the API.
    service_code str
    filters List<Property Map>
    id String
    The provider-assigned unique ID for this managed resource.
    result String
    Set to the product returned from the API.
    serviceCode String

    Supporting Types

    GetProductFilter

    Field string
    Product attribute name that you want to filter on.
    Value string
    Product attribute value that you want to filter on.
    Field string
    Product attribute name that you want to filter on.
    Value string
    Product attribute value that you want to filter on.
    field String
    Product attribute name that you want to filter on.
    value String
    Product attribute value that you want to filter on.
    field string
    Product attribute name that you want to filter on.
    value string
    Product attribute value that you want to filter on.
    field str
    Product attribute name that you want to filter on.
    value str
    Product attribute value that you want to filter on.
    field String
    Product attribute name that you want to filter on.
    value String
    Product attribute value that you want to filter on.

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi