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<Get
Product Filter Args> 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 string The code of the service. Available service codes can be fetched using the DescribeServices pricing API call.
- Filters
[]Get
Product Filter 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 string The code of the service. Available service codes can be fetched using the DescribeServices pricing API call.
- filters
Get
Product Filter[] 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 string The code of the service. Available service codes can be fetched using the DescribeServices pricing API call.
- filters
List[Get
Product Filter] 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<Get
Product Filter> - Id string
The provider-assigned unique ID for this managed resource.
- Result string
Set to the product returned from the API.
- Service
Code string
- Filters
[]Get
Product Filter - Id string
The provider-assigned unique ID for this managed resource.
- Result string
Set to the product returned from the API.
- Service
Code string
- filters
Get
Product Filter[] - id string
The provider-assigned unique ID for this managed resource.
- result string
Set to the product returned from the API.
- service
Code string
- filters
List[Get
Product Filter] - 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
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.