Reputation: 2001
Unfortunately, in my org there is not a good tag enforcement. Is it possible to group the ec2 costs by key pair used using boto3 or some other way? I don't see any methods here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ce.html
I was able to do it with tag.
Upvotes: 0
Views: 107
Reputation: 269340
A keypair is used to authenticate to the operating system. AWS has no involvement in this login process. Therefore, it cannot link activity to keypairs. (That is, it doesn't know who is logging in each time.)
However, instances do have a KeyName
attribute that identifies which Keypair was used when the instance was launched. Users could still login under a different username if that user has been created on the instance.
While the KeyName
attribute is associated with an instance, it cannot be used to group costs. You could, however, copy the KeyName to a Tag, which could then be used for grouping in billing reports.
Upvotes: 1