getSpotPrice

Information about most recent Spot Price for a given EC2 instance.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Aws.Ec2.GetSpotPrice.InvokeAsync(new Aws.Ec2.GetSpotPriceArgs
        {
            AvailabilityZone = "us-west-2a",
            Filters = 
            {
                new Aws.Ec2.Inputs.GetSpotPriceFilterArgs
                {
                    Name = "product-description",
                    Values = 
                    {
                        "Linux/UNIX",
                    },
                },
            },
            InstanceType = "t3.medium",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "us-west-2a"
		opt1 := "t3.medium"
		_, err := ec2.GetSpotPrice(ctx, &ec2.GetSpotPriceArgs{
			AvailabilityZone: &opt0,
			Filters: []ec2.GetSpotPriceFilter{
				ec2.GetSpotPriceFilter{
					Name: "product-description",
					Values: []string{
						"Linux/UNIX",
					},
				},
			},
			InstanceType: &opt1,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

example = aws.ec2.get_spot_price(availability_zone="us-west-2a",
    filters=[aws.ec2.GetSpotPriceFilterArgs(
        name="product-description",
        values=["Linux/UNIX"],
    )],
    instance_type="t3.medium")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = pulumi.output(aws.ec2.getSpotPrice({
    availabilityZone: "us-west-2a",
    filters: [{
        name: "product-description",
        values: ["Linux/UNIX"],
    }],
    instanceType: "t3.medium",
}, { async: true }));

Using getSpotPrice

function getSpotPrice(args: GetSpotPriceArgs, opts?: InvokeOptions): Promise<GetSpotPriceResult>
def get_spot_price(availability_zone: Optional[str] = None,
                   filters: Optional[Sequence[GetSpotPriceFilter]] = None,
                   instance_type: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetSpotPriceResult
func GetSpotPrice(ctx *Context, args *GetSpotPriceArgs, opts ...InvokeOption) (*GetSpotPriceResult, error)

Note: This function is named GetSpotPrice in the Go SDK.

public static class GetSpotPrice {
    public static Task<GetSpotPriceResult> InvokeAsync(GetSpotPriceArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

AvailabilityZone string
The availability zone in which to query Spot price information.
Filters List<GetSpotPriceFilter>
One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
InstanceType string
The type of instance for which to query Spot Price information.
AvailabilityZone string
The availability zone in which to query Spot price information.
Filters []GetSpotPriceFilter
One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
InstanceType string
The type of instance for which to query Spot Price information.
availabilityZone string
The availability zone in which to query Spot price information.
filters GetSpotPriceFilter[]
One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
instanceType string
The type of instance for which to query Spot Price information.
availability_zone str
The availability zone in which to query Spot price information.
filters Sequence[GetSpotPriceFilter]
One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
instance_type str
The type of instance for which to query Spot Price information.

getSpotPrice Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
SpotPrice string
The most recent Spot Price value for the given instance type and AZ.
SpotPriceTimestamp string
The timestamp at which the Spot Price value was published.
AvailabilityZone string
Filters List<GetSpotPriceFilter>
InstanceType string
Id string
The provider-assigned unique ID for this managed resource.
SpotPrice string
The most recent Spot Price value for the given instance type and AZ.
SpotPriceTimestamp string
The timestamp at which the Spot Price value was published.
AvailabilityZone string
Filters []GetSpotPriceFilter
InstanceType string
id string
The provider-assigned unique ID for this managed resource.
spotPrice string
The most recent Spot Price value for the given instance type and AZ.
spotPriceTimestamp string
The timestamp at which the Spot Price value was published.
availabilityZone string
filters GetSpotPriceFilter[]
instanceType string
id str
The provider-assigned unique ID for this managed resource.
spot_price str
The most recent Spot Price value for the given instance type and AZ.
spot_price_timestamp str
The timestamp at which the Spot Price value was published.
availability_zone str
filters Sequence[GetSpotPriceFilter]
instance_type str

Supporting Types

GetSpotPriceFilter

Name string
Name of the filter.
Values List<string>
List of one or more values for the filter.
Name string
Name of the filter.
Values []string
List of one or more values for the filter.
name string
Name of the filter.
values string[]
List of one or more values for the filter.
name str
Name of the filter.
values Sequence[str]
List of one or more values for the filter.

Package Details

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