AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.11.0 published on Wednesday, Aug 17, 2022 by Pulumi

getProduct

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

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.Pricing.GetProduct.Invoke(new()
    {
        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",
            },
        },
        ServiceCode = "AmazonEC2",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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{
			Filters: []pricing.GetProductFilter{
				pricing.GetProductFilter{
					Field: "instanceType",
					Value: "c5.xlarge",
				},
				pricing.GetProductFilter{
					Field: "operatingSystem",
					Value: "Linux",
				},
				pricing.GetProductFilter{
					Field: "location",
					Value: "US East (N. Virginia)",
				},
				pricing.GetProductFilter{
					Field: "preInstalledSw",
					Value: "NA",
				},
				pricing.GetProductFilter{
					Field: "licenseModel",
					Value: "No License required",
				},
				pricing.GetProductFilter{
					Field: "tenancy",
					Value: "Shared",
				},
				pricing.GetProductFilter{
					Field: "capacitystatus",
					Value: "Used",
				},
			},
			ServiceCode: "AmazonEC2",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
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()
            .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())
            .serviceCode("AmazonEC2")
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.pricing.get_product(filters=[
        aws.pricing.GetProductFilterArgs(
            field="instanceType",
            value="c5.xlarge",
        ),
        aws.pricing.GetProductFilterArgs(
            field="operatingSystem",
            value="Linux",
        ),
        aws.pricing.GetProductFilterArgs(
            field="location",
            value="US East (N. Virginia)",
        ),
        aws.pricing.GetProductFilterArgs(
            field="preInstalledSw",
            value="NA",
        ),
        aws.pricing.GetProductFilterArgs(
            field="licenseModel",
            value="No License required",
        ),
        aws.pricing.GetProductFilterArgs(
            field="tenancy",
            value="Shared",
        ),
        aws.pricing.GetProductFilterArgs(
            field="capacitystatus",
            value="Used",
        ),
    ],
    service_code="AmazonEC2")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = pulumi.output(aws.pricing.getProduct({
    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",
        },
    ],
    serviceCode: "AmazonEC2",
}));
variables:
  example:
    Fn::Invoke:
      Function: aws:pricing:getProduct
      Arguments:
        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
        serviceCode: AmazonEC2

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>

A 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

The code of the service. Available service codes can be fetched using the DescribeServices pricing API call.

Filters []GetProductFilter

A 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

The code of the service. Available service codes can be fetched using the DescribeServices pricing API call.

filters List<GetProductFilter>

A 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

The code of the service. Available service codes can be fetched using the DescribeServices pricing API call.

filters GetProductFilter[]

A 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

The code of the service. Available service codes can be fetched using the DescribeServices pricing API call.

filters Sequence[GetProductFilter]

A 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

The code of the service. Available service codes can be fetched using the DescribeServices pricing API call.

filters List<Property Map>

A 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

The 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

The product attribute name that you want to filter on.

Value string

The product attribute value that you want to filter on.

Field string

The product attribute name that you want to filter on.

Value string

The product attribute value that you want to filter on.

field String

The product attribute name that you want to filter on.

value String

The product attribute value that you want to filter on.

field string

The product attribute name that you want to filter on.

value string

The product attribute value that you want to filter on.

field str

The product attribute name that you want to filter on.

value str

The product attribute value that you want to filter on.

field String

The product attribute name that you want to filter on.

value String

The product attribute value that you want to filter on.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.