How to efficiently store AWS machine IDs in Db
We have a web application deployed on quite a few AWS machines, all served by a central (MySQL) DB.
We currently log some events to a table in DB, and would like to add some sort of identification which machine generated the event. We are l开发者_Python百科ooking for the most efficient way to do so.
What would be a good source for this - machine IP address? Instance ID? And how to store it - as a straight up Varchar? As a Numeric value? As a hash of some sort?
I can't see any reason not to use an instance Id, as is, in your log records? IP addresses can change, especially if Elastic IP addresses are not in use. Storing the instance Id as a Varchar should suffice, but you may also want to note the Availability Zone and Region of the launched machine (instance Ids are not guaranteed to be unique world-wide).
精彩评论