1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. SpotDatafeedSubscription
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.ec2.SpotDatafeedSubscription

Explore with Pulumi AI

Note: There is only a single subscription allowed per account.

To help you understand the charges for your Spot instances, Amazon EC2 provides a data feed that describes your Spot instance usage and pricing. This data feed is sent to an Amazon S3 bucket that you specify when you subscribe to the data feed.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const _default = new aws.s3.BucketV2("default", {bucket: "tf-spot-datafeed"});
const defaultSpotDatafeedSubscription = new aws.ec2.SpotDatafeedSubscription("default", {
    bucket: _default.id,
    prefix: "my_subdirectory",
});
Copy
import pulumi
import pulumi_aws as aws

default = aws.s3.BucketV2("default", bucket="tf-spot-datafeed")
default_spot_datafeed_subscription = aws.ec2.SpotDatafeedSubscription("default",
    bucket=default.id,
    prefix="my_subdirectory")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := s3.NewBucketV2(ctx, "default", &s3.BucketV2Args{
			Bucket: pulumi.String("tf-spot-datafeed"),
		})
		if err != nil {
			return err
		}
		_, err = ec2.NewSpotDatafeedSubscription(ctx, "default", &ec2.SpotDatafeedSubscriptionArgs{
			Bucket: _default.ID(),
			Prefix: pulumi.String("my_subdirectory"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var @default = new Aws.S3.BucketV2("default", new()
    {
        Bucket = "tf-spot-datafeed",
    });

    var defaultSpotDatafeedSubscription = new Aws.Ec2.SpotDatafeedSubscription("default", new()
    {
        Bucket = @default.Id,
        Prefix = "my_subdirectory",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketV2Args;
import com.pulumi.aws.ec2.SpotDatafeedSubscription;
import com.pulumi.aws.ec2.SpotDatafeedSubscriptionArgs;
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) {
        var default_ = new BucketV2("default", BucketV2Args.builder()
            .bucket("tf-spot-datafeed")
            .build());

        var defaultSpotDatafeedSubscription = new SpotDatafeedSubscription("defaultSpotDatafeedSubscription", SpotDatafeedSubscriptionArgs.builder()
            .bucket(default_.id())
            .prefix("my_subdirectory")
            .build());

    }
}
Copy
resources:
  default:
    type: aws:s3:BucketV2
    properties:
      bucket: tf-spot-datafeed
  defaultSpotDatafeedSubscription:
    type: aws:ec2:SpotDatafeedSubscription
    name: default
    properties:
      bucket: ${default.id}
      prefix: my_subdirectory
Copy

Create SpotDatafeedSubscription Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new SpotDatafeedSubscription(name: string, args: SpotDatafeedSubscriptionArgs, opts?: CustomResourceOptions);
@overload
def SpotDatafeedSubscription(resource_name: str,
                             args: SpotDatafeedSubscriptionArgs,
                             opts: Optional[ResourceOptions] = None)

@overload
def SpotDatafeedSubscription(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             bucket: Optional[str] = None,
                             prefix: Optional[str] = None)
func NewSpotDatafeedSubscription(ctx *Context, name string, args SpotDatafeedSubscriptionArgs, opts ...ResourceOption) (*SpotDatafeedSubscription, error)
public SpotDatafeedSubscription(string name, SpotDatafeedSubscriptionArgs args, CustomResourceOptions? opts = null)
public SpotDatafeedSubscription(String name, SpotDatafeedSubscriptionArgs args)
public SpotDatafeedSubscription(String name, SpotDatafeedSubscriptionArgs args, CustomResourceOptions options)
type: aws:ec2:SpotDatafeedSubscription
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SpotDatafeedSubscriptionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SpotDatafeedSubscriptionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SpotDatafeedSubscriptionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SpotDatafeedSubscriptionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SpotDatafeedSubscriptionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var spotDatafeedSubscriptionResource = new Aws.Ec2.SpotDatafeedSubscription("spotDatafeedSubscriptionResource", new()
{
    Bucket = "string",
    Prefix = "string",
});
Copy
example, err := ec2.NewSpotDatafeedSubscription(ctx, "spotDatafeedSubscriptionResource", &ec2.SpotDatafeedSubscriptionArgs{
	Bucket: pulumi.String("string"),
	Prefix: pulumi.String("string"),
})
Copy
var spotDatafeedSubscriptionResource = new SpotDatafeedSubscription("spotDatafeedSubscriptionResource", SpotDatafeedSubscriptionArgs.builder()
    .bucket("string")
    .prefix("string")
    .build());
Copy
spot_datafeed_subscription_resource = aws.ec2.SpotDatafeedSubscription("spotDatafeedSubscriptionResource",
    bucket="string",
    prefix="string")
Copy
const spotDatafeedSubscriptionResource = new aws.ec2.SpotDatafeedSubscription("spotDatafeedSubscriptionResource", {
    bucket: "string",
    prefix: "string",
});
Copy
type: aws:ec2:SpotDatafeedSubscription
properties:
    bucket: string
    prefix: string
Copy

SpotDatafeedSubscription Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The SpotDatafeedSubscription resource accepts the following input properties:

Bucket
This property is required.
Changes to this property will trigger replacement.
string
The Amazon S3 bucket in which to store the Spot instance data feed.
Prefix Changes to this property will trigger replacement. string
Path of folder inside bucket to place spot pricing data.
Bucket
This property is required.
Changes to this property will trigger replacement.
string
The Amazon S3 bucket in which to store the Spot instance data feed.
Prefix Changes to this property will trigger replacement. string
Path of folder inside bucket to place spot pricing data.
bucket
This property is required.
Changes to this property will trigger replacement.
String
The Amazon S3 bucket in which to store the Spot instance data feed.
prefix Changes to this property will trigger replacement. String
Path of folder inside bucket to place spot pricing data.
bucket
This property is required.
Changes to this property will trigger replacement.
string
The Amazon S3 bucket in which to store the Spot instance data feed.
prefix Changes to this property will trigger replacement. string
Path of folder inside bucket to place spot pricing data.
bucket
This property is required.
Changes to this property will trigger replacement.
str
The Amazon S3 bucket in which to store the Spot instance data feed.
prefix Changes to this property will trigger replacement. str
Path of folder inside bucket to place spot pricing data.
bucket
This property is required.
Changes to this property will trigger replacement.
String
The Amazon S3 bucket in which to store the Spot instance data feed.
prefix Changes to this property will trigger replacement. String
Path of folder inside bucket to place spot pricing data.

Outputs

All input properties are implicitly available as output properties. Additionally, the SpotDatafeedSubscription resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing SpotDatafeedSubscription Resource

Get an existing SpotDatafeedSubscription resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SpotDatafeedSubscriptionState, opts?: CustomResourceOptions): SpotDatafeedSubscription
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket: Optional[str] = None,
        prefix: Optional[str] = None) -> SpotDatafeedSubscription
func GetSpotDatafeedSubscription(ctx *Context, name string, id IDInput, state *SpotDatafeedSubscriptionState, opts ...ResourceOption) (*SpotDatafeedSubscription, error)
public static SpotDatafeedSubscription Get(string name, Input<string> id, SpotDatafeedSubscriptionState? state, CustomResourceOptions? opts = null)
public static SpotDatafeedSubscription get(String name, Output<String> id, SpotDatafeedSubscriptionState state, CustomResourceOptions options)
resources:  _:    type: aws:ec2:SpotDatafeedSubscription    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Bucket Changes to this property will trigger replacement. string
The Amazon S3 bucket in which to store the Spot instance data feed.
Prefix Changes to this property will trigger replacement. string
Path of folder inside bucket to place spot pricing data.
Bucket Changes to this property will trigger replacement. string
The Amazon S3 bucket in which to store the Spot instance data feed.
Prefix Changes to this property will trigger replacement. string
Path of folder inside bucket to place spot pricing data.
bucket Changes to this property will trigger replacement. String
The Amazon S3 bucket in which to store the Spot instance data feed.
prefix Changes to this property will trigger replacement. String
Path of folder inside bucket to place spot pricing data.
bucket Changes to this property will trigger replacement. string
The Amazon S3 bucket in which to store the Spot instance data feed.
prefix Changes to this property will trigger replacement. string
Path of folder inside bucket to place spot pricing data.
bucket Changes to this property will trigger replacement. str
The Amazon S3 bucket in which to store the Spot instance data feed.
prefix Changes to this property will trigger replacement. str
Path of folder inside bucket to place spot pricing data.
bucket Changes to this property will trigger replacement. String
The Amazon S3 bucket in which to store the Spot instance data feed.
prefix Changes to this property will trigger replacement. String
Path of folder inside bucket to place spot pricing data.

Import

Using pulumi import, import a Spot Datafeed Subscription using the word spot-datafeed-subscription. For example:

$ pulumi import aws:ec2/spotDatafeedSubscription:SpotDatafeedSubscription mysubscription spot-datafeed-subscription
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.