EC2.Client.
create_spot_datafeed_subscription
(**kwargs)¶Creates a data feed for Spot Instances, enabling you to view Spot Instance usage logs. You can create one data feed per Amazon Web Services account. For more information, see Spot Instance data feed in the Amazon EC2 User Guide for Linux Instances .
See also: AWS API Documentation
Request Syntax
response = client.create_spot_datafeed_subscription(
Bucket='string',
DryRun=True|False,
Prefix='string'
)
[REQUIRED]
The name of the Amazon S3 bucket in which to store the Spot Instance data feed. For more information about bucket names, see Rules for bucket naming in the Amazon S3 Developer Guide .
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.dict
Response Syntax
{
'SpotDatafeedSubscription': {
'Bucket': 'string',
'Fault': {
'Code': 'string',
'Message': 'string'
},
'OwnerId': 'string',
'Prefix': 'string',
'State': 'Active'|'Inactive'
}
}
Response Structure
(dict) --
Contains the output of CreateSpotDatafeedSubscription.
SpotDatafeedSubscription (dict) --
The Spot Instance data feed subscription.
Bucket (string) --
The name of the Amazon S3 bucket where the Spot Instance data feed is located.
Fault (dict) --
The fault codes for the Spot Instance request, if any.
Code (string) --
The reason code for the Spot Instance state change.
Message (string) --
The message for the Spot Instance state change.
OwnerId (string) --
The Amazon Web Services account ID of the account.
Prefix (string) --
The prefix for the data feed files.
State (string) --
The state of the Spot Instance data feed subscription.
Examples
This example creates a Spot Instance data feed for your AWS account.
response = client.create_spot_datafeed_subscription(
Bucket='my-s3-bucket',
Prefix='spotdata',
)
print(response)
Expected Output:
{
'SpotDatafeedSubscription': {
'Bucket': 'my-s3-bucket',
'OwnerId': '123456789012',
'Prefix': 'spotdata',
'State': 'Active',
},
'ResponseMetadata': {
'...': '...',
},
}