Spot Instance Data Feed
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.
Data feed files arrive in your bucket typically once an hour, and each hour of usage is typically covered in a single data file. These files are compressed (gzip) before they are delivered to your bucket. Amazon EC2 can write multiple files for a given hour of usage where files are very large (for example, when file contents for the hour exceed 50 MB before compression).
Note
If you don't have a Spot instance running during a certain hour, you won't receive a data feed file for that hour.
Contents
Data Feed File Name and Format
The Spot instance data feed file name uses the following format (with the date and hour in UTC):
bucket-name.s3.amazonaws.com/{optional prefix}/aws-account-id.YYYY-MM-DD-HH.n.unique-id.gzFor example, if your bucket name is myawsbucket and your
prefix is myprefix, your file names are similar to the
following:
myawsbucket.s3.amazonaws.com/myprefix/111122223333.2014-03-17-20.001.pwBdGTJG.gzThe Spot instance data feed files are tab-delimited. Each line in the data file corresponds to one instance hour and contains the fields listed in the following table.
| Field | Description |
|---|---|
|
|
The timestamp used to determine the price charged for this instance hour. |
|
|
The type of usage and instance type being charged for. For
|
|
|
The product being charged for. For Linux Spot instances, this
field is set to |
|
|
The ID of the Spot instance that generated this instance hour. |
|
|
The ID for the Spot instance request that generated this instance hour. |
|
|
The maximum price specified for this Spot instance request. |
|
|
The Spot price at the time specified in the |
|
|
The price charged for this instance hour. |
|
|
The version included in the data feed file name for this record. |
Amazon S3 Bucket Permissions
When you subscribe to the data feed, you must specify an Amazon S3 bucket to store the data feed files. Before you choose an Amazon S3 bucket for the data feed, consider the following:
You must have
FULL_CONTROLpermission to the bucket.If you're the bucket owner, you have this permission by default. Otherwise, the bucket owner must grant your AWS account this permission.
When you create your data feed subscription, Amazon S3 updates the ACL of the specified bucket to allow the AWS data feed account read and write permissions.
Removing the permissions for the data feed account does not disable the data feed. If you remove those permissions but don't disable the data feed, we restore those permissions the next time that the data feed account needs to write to the bucket.
Each data feed file has its own ACL (separate from the ACL for the bucket). The bucket owner has
FULL_CONTROLpermission to the data files. The data feed account has read and write permissions.If you delete your data feed subscription, Amazon EC2 doesn't remove the read and write permissions for the data feed account on either the bucket or the data files. You must remove these permissions yourself.
Subscribing to Your Spot instance Data Feed
You can subscribe to your Spot instance data feed using the command line or API.
Subscribe Using the AWS CLI
To subscribe to your data feed, use the following create-spot-datafeed-subscription command:
$ aws ec2 create-spot-datafeed-subscription --bucket myawsbucket [--prefix myprefix]The following is example output:
{
"SpotDatafeedSubscription": {
"OwnerId": "111122223333",
"Prefix": "myprefix",
"Bucket": "myawsbucket",
"State": "Active"
}
}Subscribe Using the Amazon EC2 CLI
To subscribe to your data feed, use the following ec2-create-spot-datafeed-subscription command:
$ ec2-create-spot-datafeed-subscription --bucket myawsbucket [--prefix myprefix]The following is example output:
SPOTDATAFEEDSUBSCRIPTION 111122223333 myawsbucket myprefix ActiveDeleting Your Spot Instance Data Feed
You can delete your Spot instance data feed using the command line or API .
Delete Using the AWS CLI
To delete your data feed, use the following delete-spot-datafeed-subscription command:
$ aws ec2 delete-spot-datafeed-subscriptionDelete Using the Amazon EC2 CLI
To delete your data feed, use the following ec2-delete-spot-datafeed-subscription command:
$ ec2-delete-spot-datafeed-subscription
