Information about most recent Spot Price for a given EC2 instance.
data "aws_ec2_spot_price" "example" {
instance_type = "t3.medium"
availability_zone = "us-west-2a"
filter {
name = "product-description"
values = ["Linux/UNIX"]
}
}
This data source supports the following arguments:
instance_type
- (Optional) Type of instance for which to query Spot Price information.availability_zone
- (Optional) Availability zone in which to query Spot price information.filter
- (Optional) One or more configuration blocks containing name-values filters. See the EC2 API Reference for supported filters. Detailed below.name
- (Required) Name of the filter.values
- (Required) List of one or more values for the filter.This data source exports the following attributes in addition to the arguments above:
id
- AWS Region.spot_price
- Most recent Spot Price value for the given instance type and AZ.spot_price_timestamp
- The timestamp at which the Spot Price value was published.read
- (Default 20m
)