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 Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Aws.Pricing.GetProduct.InvokeAsync(new Aws.Pricing.GetProductArgs
        {
            Filters = 
            {
                new Aws.Pricing.Inputs.GetProductFilterArgs
                {
                    Field = "instanceType",
                    Value = "c5.xlarge",
                },
                new Aws.Pricing.Inputs.GetProductFilterArgs
                {
                    Field = "operatingSystem",
                    Value = "Linux",
                },
                new Aws.Pricing.Inputs.GetProductFilterArgs
                {
                    Field = "location",
                    Value = "US East (N. Virginia)",
                },
                new Aws.Pricing.Inputs.GetProductFilterArgs
                {
                    Field = "preInstalledSw",
                    Value = "NA",
                },
                new Aws.Pricing.Inputs.GetProductFilterArgs
                {
                    Field = "licenseModel",
                    Value = "No License required",
                },
                new Aws.Pricing.Inputs.GetProductFilterArgs
                {
                    Field = "tenancy",
                    Value = "Shared",
                },
                new Aws.Pricing.Inputs.GetProductFilterArgs
                {
                    Field = "capacitystatus",
                    Value = "Used",
                },
            },
            ServiceCode = "AmazonEC2",
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/pricing"
    "github.com/pulumi/pulumi/sdk/v2/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
    })
}
import pulumi
import pulumi_aws as aws

example = aws.pricing.get_product(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",
        },
    ],
    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",
}, { async: true }));

Using GetProduct

function getProduct(args: GetProductArgs, opts?: InvokeOptions): Promise<GetProductResult>
function  get_product(filters=None, service_code=None, opts=None)
func GetProduct(ctx *Context, args *GetProductArgs, opts ...InvokeOption) (*GetProductResult, error)
public static class GetProduct {
    public static Task<GetProductResult> InvokeAsync(GetProductArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Filters List<GetProductFilterArgs>

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 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.

service_code str

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 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 str

The provider-assigned unique ID for this managed resource.

result str

Set to the product returned from the API.

service_code str

Supporting Types

GetProductFilter

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

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.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.