title: display ec2.describe.instance.status 's parameters
body: <p>i am writtnig a lambda function on serverless framework that resturns instance's status, i used boto3</p>
  
  <pre><code>describe_instance_status()    
  </code></pre>
  
  <p>my code works fine, i get all the parameters, but i want to display just The state of the instance (pending | running | shutting-down).</p>
  
  <p>here is my code :</p>
  
  <pre><code> import json
   import boto3
   import logging
   import sys 
   import os
   import traceback
  
   # Import local dependencies sys.path.append('./site-packages')
  
   from botocore.exceptions import ClientError from pprint import pprint
  
   #setup simple logging for INFO logger = logging.getLogger() 
   logger.setLevel(logging.INFO)
  
   from botocore.exceptions import ClientError
  
  
   def  instance_status(event, context):
    """Take an instance Id and return its status"""
   body = {}
   status_code = 200
  
   try:
      client = boto3.client('ec2')
      r = client.describe_instance_status(InstanceIds=['i-070ad081'])
       body["message"] = str(r)
   except Exception as e:
       print(traceback.format_exc())
       status_code = 500
       body["message"] = str(e)
   #need a json body to return the status
   response = {
       "statusCode": status_code,
       "body": json.dumps(body)
   }  
   return response
  </code></pre>
  
  <p>Here is the http output :</p>
  
  <pre><code>{
  "message": "{u'InstanceStatuses': [{u'InstanceId': 'i-070ad071', u'InstanceState': {u'Code': 16, u'Name': 'running'}, u'AvailabilityZone': 'us-east-1a', u'SystemStatus': {u'Status': 'ok', u'Details': [{u'Status': 'passed', u'Name': 'reachability'}]}, u'InstanceStatus': {u'Status': 'ok', u'Details': [{u'Status': 'passed', u'Name': 'reachability'}]}}], 'ResponseMetadata': {'RetryAttempts': 0, 'HTTPStatusCode': 200, 'RequestId': '35684bc5-2ab5-4225-8f8b-66bb217866f8', 'HTTPHeaders': {'transfer-encoding': 'chunked', 'vary': 'Accept-Encoding', 'server': 'AmazonEC2', 'content-type': 'text/xml;charset=UTF-8', 'date': 'Tue, 26 Sep 2017 09:36:15 GMT'}}}"
  }    
  </code></pre>