title: How to create Start instance lambda function in aws using python?
body: <p>When trying to create a function lambda in AWS in order to start instance automatically, this is the function:</p>
  
  <pre class="lang-py prettyprint-override"><code>import boto3
  region = 'us-east-1'
  instances = ['i-xxx']
  ec2 = boto3.client('ec2', region_name=region)
  
  def lambda_handler(event, context):
      ec2.stop_instances(InstanceIds=instances)
      print('stopped your instances: ' + str(instances))
  </code></pre>
  
  <p>and after Save and Test - I got this error:</p>
  
  <pre><code>Response:
  {
    "errorMessage": "2019-09-15T09:54:06.364Z 372c2df4-1303-4326-b882-a04154007881 Task timed out after 3.00 seconds"
  }
  
  Request ID:
  "372c2df4-1303-4326-b882-a04154007881"
  
  Function Logs:
  START RequestId: 372c2df4-1303-4326-b882-a04154007881 Version: $LATEST
  END RequestId: 372c2df4-1303-4326-b882-a04154007881
  REPORT RequestId: 372c2df4-1303-4326-b882-a04154007881  Duration: 3003.17 ms    Billed Duration: 3000 ms    Memory Size: 128 MB Max Memory Used: 81 MB  Init Duration: 115.73 ms    
  XRAY TraceId: 1-5d7e0a3b-79a0391249fcda644105b8ba   SegmentId: 0eefbaed756a35c4 Sampled: false  
  2019-09-15T09:54:06.364Z 372c2df4-1303-4326-b882-a04154007881 Task timed out after 3.00 seconds
  
  </code></pre>