CrowdStrike / cloud-resource-estimator

Cloud deployment size calculation utilities
The Unlicense
17 stars 19 forks source link

AWS Benchmark is Accounting for Terminated Spot EC2 Instances #5

Closed jamiepeloquin closed 2 years ago

jamiepeloquin commented 2 years ago

Issue: When running the benchmark script in an AWS account, I noticed an oddly large number of EC2s being accounted for. When looking into this further I noticed that 36, of the total instances, were actually “Terminated”. When running the script in an account that does not use Spot Instances, we did not see any discrepancies.

Possible Solution: Looking at the instance description, from the CLI/API, you should be able to filter on the Instance’s State.Name == 'terminated' to remove these special cases from the results.

From what I can derive, I think AWS tracks the Terminated Spot Instances to allow the owner to look into why a Spot Instance might have been terminated, and when.

jshcodes commented 2 years ago

Hi @jamiepeloquin -

I've added a filter to the describe_instances call in aws_cspm_benchmark.py to filter out terminated instances. Would you test in your environment and let us know if there are any problems?

Thank you for reporting this! :smile: