Skip to content

Data Source: awsEc2SpotPrice

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

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsEc2SpotPrice.DataAwsEc2SpotPrice(this, "example", {
  availabilityZone: "us-west-2a",
  filter: [
    {
      name: "product-description",
      values: ["Linux/UNIX"],
    },
  ],
  instanceType: "t3.medium",
});

Argument Reference

The following arguments are supported:

  • instanceType - (Optional) Type of instance for which to query Spot Price information.
  • availabilityZone - (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.

filter Argument Reference

  • name - (Required) Name of the filter.
  • values - (Required) List of one or more values for the filter.

Attribute Reference

In addition to all arguments above, the following attributes are exported:

  • id - AWS Region.
  • spotPrice - Most recent Spot Price value for the given instance type and AZ.
  • spotPriceTimestamp - The timestamp at which the Spot Price value was published.

Timeouts

Configuration options:

  • read - (Default 20M)