title: Checking STOP time of EC2 instance with boto3
body: <p>Python 2.7
  Boto3</p>
  
  <p>I'm trying to get a timestamp of when the instance was stopped OR the time the last state transition took place OR a duration of how long the instance has been in the current state. </p>
  
  <p>My goal is to test if an instance has been stopped for x hours.</p>
  
  <p>For example, </p>
  
  <pre><code>instance = ec2.Instance('myinstanceID')
  if int(instance.state['Code']) == 80:
      stop_time = instance.state_change_time() #Dummy method.
  </code></pre>
  
  <p>Or something similar to that. </p>
  
  <p>I see that boto3 has a <code>launch_time</code> method. And lots of ways to analyze state changes using <code>state_transition_reason</code> and <code>state_reason</code> but I'm not seeing anything regarding the state transition timestamp. </p>
  
  <p>I've got to be missing something. </p>
  
  <p>Here is the Boto3 docs for Instance "state" methods...</p>
  
  <pre><code>state
  (dict) --
  
  The current state of the instance.
  
  Code (integer) --
  
  The low byte represents the state. The high byte is an opaque internal value and should be ignored.
  
  0 : pending
  16 : running
  32 : shutting-down
  48 : terminated
  64 : stopping
  80 : stopped
  Name (string) --
  
  The current state of the instance.
  
  
  state_reason
  (dict) --
  
  The reason for the most recent state transition.
  
  Code (string) --
  
  The reason code for the state change.
  
  Message (string) --
  
  The message for the state change.
  
  Server.SpotInstanceTermination : A Spot instance was terminated due to an increase in the market price.
  Server.InternalError : An internal error occurred during instance launch, resulting in termination.
  Server.InsufficientInstanceCapacity : There was insufficient instance capacity to satisfy the launch request.
  Client.InternalError : A client error caused the instance to terminate on launch.
  Client.InstanceInitiatedShutdown : The instance was shut down using the shutdown -h command from the instance.
  Client.UserInitiatedShutdown : The instance was shut down using the Amazon EC2 API.
  Client.VolumeLimitExceeded : The limit on the number of EBS volumes or total storage was exceeded. Decrease usage or request an increase in your limits.
  Client.InvalidSnapshot.NotFound : The specified snapshot was not found.
  
  
  state_transition_reason
  (string) --
  
  The reason for the most recent state transition. This might be an empty string.
  </code></pre>