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.ec2.getSpotPrice
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi
Information about most recent Spot Price for a given EC2 instance.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2.getSpotPrice({
instanceType: "t3.medium",
availabilityZone: "us-west-2a",
filters: [{
name: "product-description",
values: ["Linux/UNIX"],
}],
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.get_spot_price(instance_type="t3.medium",
availability_zone="us-west-2a",
filters=[{
"name": "product-description",
"values": ["Linux/UNIX"],
}])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.GetSpotPrice(ctx, &ec2.GetSpotPriceArgs{
InstanceType: pulumi.StringRef("t3.medium"),
AvailabilityZone: pulumi.StringRef("us-west-2a"),
Filters: []ec2.GetSpotPriceFilter{
{
Name: "product-description",
Values: []string{
"Linux/UNIX",
},
},
},
}, 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.Ec2.GetSpotPrice.Invoke(new()
{
InstanceType = "t3.medium",
AvailabilityZone = "us-west-2a",
Filters = new[]
{
new Aws.Ec2.Inputs.GetSpotPriceFilterInputArgs
{
Name = "product-description",
Values = new[]
{
"Linux/UNIX",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetSpotPriceArgs;
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 = Ec2Functions.getSpotPrice(GetSpotPriceArgs.builder()
.instanceType("t3.medium")
.availabilityZone("us-west-2a")
.filters(GetSpotPriceFilterArgs.builder()
.name("product-description")
.values("Linux/UNIX")
.build())
.build());
}
}
variables:
example:
fn::invoke:
Function: aws:ec2:getSpotPrice
Arguments:
instanceType: t3.medium
availabilityZone: us-west-2a
filters:
- name: product-description
values:
- Linux/UNIX
Using getSpotPrice
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 getSpotPrice(args: GetSpotPriceArgs, opts?: InvokeOptions): Promise<GetSpotPriceResult>
function getSpotPriceOutput(args: GetSpotPriceOutputArgs, opts?: InvokeOptions): Output<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
def get_spot_price_output(availability_zone: Optional[pulumi.Input[str]] = None,
filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSpotPriceFilterArgs]]]] = None,
instance_type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSpotPriceResult]
func GetSpotPrice(ctx *Context, args *GetSpotPriceArgs, opts ...InvokeOption) (*GetSpotPriceResult, error)
func GetSpotPriceOutput(ctx *Context, args *GetSpotPriceOutputArgs, opts ...InvokeOption) GetSpotPriceResultOutput
> Note: This function is named GetSpotPrice
in the Go SDK.
public static class GetSpotPrice
{
public static Task<GetSpotPriceResult> InvokeAsync(GetSpotPriceArgs args, InvokeOptions? opts = null)
public static Output<GetSpotPriceResult> Invoke(GetSpotPriceInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSpotPriceResult> getSpotPrice(GetSpotPriceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:ec2/getSpotPrice:getSpotPrice
arguments:
# arguments dictionary
The following arguments are supported:
- Availability
Zone string - Availability zone in which to query Spot price information.
- Filters
List<Get
Spot Price Filter> - One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- Instance
Type string - Type of instance for which to query Spot Price information.
- Availability
Zone string - Availability zone in which to query Spot price information.
- Filters
[]Get
Spot Price Filter - One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- Instance
Type string - Type of instance for which to query Spot Price information.
- availability
Zone String - Availability zone in which to query Spot price information.
- filters
List<Get
Spot Price Filter> - One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- instance
Type String - Type of instance for which to query Spot Price information.
- availability
Zone string - Availability zone in which to query Spot price information.
- filters
Get
Spot Price Filter[] - One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- instance
Type string - Type of instance for which to query Spot Price information.
- availability_
zone str - Availability zone in which to query Spot price information.
- filters
Sequence[Get
Spot Price Filter] - One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- instance_
type str - Type of instance for which to query Spot Price information.
- availability
Zone String - Availability zone in which to query Spot price information.
- filters List<Property Map>
- One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.
- instance
Type String - 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.
- Spot
Price string - Most recent Spot Price value for the given instance type and AZ.
- Spot
Price stringTimestamp - The timestamp at which the Spot Price value was published.
- Availability
Zone string - Filters
List<Get
Spot Price Filter> - Instance
Type string
- Id string
- The provider-assigned unique ID for this managed resource.
- Spot
Price string - Most recent Spot Price value for the given instance type and AZ.
- Spot
Price stringTimestamp - The timestamp at which the Spot Price value was published.
- Availability
Zone string - Filters
[]Get
Spot Price Filter - Instance
Type string
- id String
- The provider-assigned unique ID for this managed resource.
- spot
Price String - Most recent Spot Price value for the given instance type and AZ.
- spot
Price StringTimestamp - The timestamp at which the Spot Price value was published.
- availability
Zone String - filters
List<Get
Spot Price Filter> - instance
Type String
- id string
- The provider-assigned unique ID for this managed resource.
- spot
Price string - Most recent Spot Price value for the given instance type and AZ.
- spot
Price stringTimestamp - The timestamp at which the Spot Price value was published.
- availability
Zone string - filters
Get
Spot Price Filter[] - instance
Type string
- id str
- The provider-assigned unique ID for this managed resource.
- spot_
price str - Most recent Spot Price value for the given instance type and AZ.
- spot_
price_ strtimestamp - The timestamp at which the Spot Price value was published.
- availability_
zone str - filters
Sequence[Get
Spot Price Filter] - instance_
type str
- id String
- The provider-assigned unique ID for this managed resource.
- spot
Price String - Most recent Spot Price value for the given instance type and AZ.
- spot
Price StringTimestamp - The timestamp at which the Spot Price value was published.
- availability
Zone String - filters List<Property Map>
- instance
Type String
Supporting Types
GetSpotPriceFilter
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.
AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi