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",
});
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")
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 {
_, 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
})
}
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",
});
});
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());
}
}
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
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 string
- The unique name of the resource.
- args SpotDatafeedSubscriptionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args 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 string
- The unique name of the resource.
- args SpotDatafeedSubscriptionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SpotDatafeedSubscriptionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
});
example, err := ec2.NewSpotDatafeedSubscription(ctx, "spotDatafeedSubscriptionResource", &ec2.SpotDatafeedSubscriptionArgs{
Bucket: pulumi.String("string"),
Prefix: pulumi.String("string"),
})
var spotDatafeedSubscriptionResource = new SpotDatafeedSubscription("spotDatafeedSubscriptionResource", SpotDatafeedSubscriptionArgs.builder()
.bucket("string")
.prefix("string")
.build());
spot_datafeed_subscription_resource = aws.ec2.SpotDatafeedSubscription("spotDatafeedSubscriptionResource",
bucket="string",
prefix="string")
const spotDatafeedSubscriptionResource = new aws.ec2.SpotDatafeedSubscription("spotDatafeedSubscriptionResource", {
bucket: "string",
prefix: "string",
});
type: aws:ec2:SpotDatafeedSubscription
properties:
bucket: string
prefix: string
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
The SpotDatafeedSubscription resource accepts the following input properties:
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)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
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
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.