AWS Benchmark is Accounting for Terminated Spot EC2 Instances
jamiepeloquin opened this issue · 1 comments
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.
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! 😄