@@ -0,0 +1,1640 @@
+import time%0A%0Afrom lib.sensorbase import EC2ConnectMixin%0A%0A%0Aclass EC2InstanceStatusSensor(EC2ConnectMixin):%0A    def __init__(self, container_service, config=None):%0A        super(EC2InstanceStatusSensor, self).__init__(config)%0A        self._container_service = container_service%0A        self._interval = config.get('interval', 20)%0A%0A    def start(self):%0A        while True:%0A            data = self._ec2.get_instance_details()%0A            for i in data:%0A                trigger = %7B%7D%0A                trigger%5B'name'%5D = 'st2.ec2.instance_status'%0A%0A                payload = data%5Bi%5D%0A                payload%5B'event_id'%5D = 'ec2-instance-check-' + str(int(time.time()))%0A                payload%5B'instance_id'%5D = i%0A                try:%0A                    self._container_service.dispatch(trigger, payload)%0A                except Exception as e:%0A                    self._log.exception('Exception %25s handling st2.ec2.instance_status', e)%0A            time.sleep(self._interval)%0A%0A    def get_trigger_types(self):%0A        return %5B%0A            %7B%0A                'name': 'st2.ec2.instance_status',%0A                'description': 'EC2 Instance Status Sensor',%0A                'payload_schema': %7B%0A                    'type': 'object',%0A                    'properties': %7B%0A                        'instance_id': %7B%7D,%0A                        'instance_type': %7B%7D,%0A                        'launch_time': %7B%7D,%0A                        'tags': %7B%7D,%0A                        'image_id': %7B%7D,%0A                        'ip_address': %7B%7D,%0A                        'state': %7B%7D,%0A                        'state_code': %7B%7D%0A                    %7D%0A                %7D%0A            %7D%0A        %5D%0A

Break out ec2instancestatussensor in separate file.