- Newest
- Most votes
- Most comments
Yes, it is possible to centralize EC2 Spot Instance data feeds from multiple accounts into one central S3 bucket. However, there are some important considerations and steps you need to take to achieve this:
-
Bucket Permissions: The central S3 bucket needs to have the appropriate permissions to allow other accounts to write their Spot Instance data feeds. You'll need to modify the bucket policy to grant the necessary permissions to the other accounts.
-
IAM Roles: In each account that will be sending Spot Instance data feeds, you need to create an IAM role that allows the EC2 service to assume the role and write to the central S3 bucket.
-
Unique Prefixes: When setting up the Spot Instance data feed for each account, use a unique prefix for each account. This will help organize the data and prevent conflicts.
-
Create Spot Data Feed Subscription: In each account, you need to run the create-spot-datafeed-subscription command, specifying the central bucket and the unique prefix for that account.
Here's an example of how you might set up the data feed for one of the accounts:
aws ec2 create-spot-datafeed-subscription --bucket central-spot-data-bucket --prefix account-123-spot-data
Repeat this process for each account, changing the prefix each time.
If you're only seeing one prefix in the bucket, it's likely that the other accounts don't have the necessary permissions to write to the bucket. Double-check the bucket policy and IAM roles in each account.
As for alternatives, if you're using OpenCost specifically for cost allocation and visualization of Spot Instance usage across multiple accounts, you might consider using AWS Organizations and AWS Cost and Usage Reports (CUR) as an alternative. This would provide a centralized way to collect and analyze cost data across all your accounts, including Spot Instance usage, without needing to set up individual data feeds.
Remember to ensure that your central bucket has appropriate encryption and access controls in place, especially if it will contain data from multiple accounts.
Sources
Track your Spot Instance costs using the Spot Instance data feed - Amazon Elastic Compute Cloud
Use CreateSpotDatafeedSubscription with a CLI - AWS SDK Code Examples
create-spot-datafeed-subscription — AWS CLI 2.25.1 Command Reference
Relevant content
- asked 5 years ago
- asked 5 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago