## 3 System Development
### Design Phase  
In this phase, the design of the system with the selected AWS components is discussed. Among the several cloud platforms (Microsoft, Google, Bosch, etc.) offering services for managing IoT devices across the edge-cloud continuum [28], we opted for AWS due to its rich ecosystem of services designed to ensure scalability, high-availability, and flexibility in the seamless integration between local and remote computing [8; 29]. Indeed, despite its steep learning curve due to its wide range of services, AWS stacks up against competitors owing to its maturity in global infrastructure and convenient pricing structure [30; 31]. For example, AWS can be preferred both to Microsoft Azure (which generally comes with higher costs and Microsoft-centric environments) and Google Cloud Platform (whose market share and third-party ecosystem are limited, being often used as part of a multi-cloud strategy), just to name a few. Thus, in order to support the functionalities listed in Section 3.1, we designed our system according to the following AWS architectural components:  
* **AWS IoT Greengrass** enables real-time operations and data analysis directly on IoT devices, without the need for a constant connection to the cloud. In particular, AWS IoT Greengrass runs AWS Lambda functions locally, synchronizes data with the cloud, and manages secure communication with other devices. In our smart environment, AWS IoT Greengrass processes sensor data such as temperature, humidity, and ozone and sends them to a PostgreSQL database for storage. * **Amazon S3** is a scalable storage service that allows for the storage and retrieval of data through an Internet connection, at any time and from anywhere. In our  
Figure 2: UV-C lamp effectiveness vs. lifetime (hours) [27]. scenario, Amazon S3 stores images and videos captured by the camera connected to the RaspberryPi to realize the video surveillance functionality. * **AWS IoT Core** enables the secure connections of IoT devices to the AWS cloud, manages data, and interacts with other AWS services. In particular, in our smart environment, it is exploited to manage communication between the Raspberry Pi and AWS services, using the MQTT protocol to transfer the collected data. * **AWS Lambda** is a serverless computing service that automatically executes code in response to events and manages the necessary resources. In our scenario, the functions process the sensor data and the video arriving through the IoT Core, triggering other operations within the system. Below we present snippets of functions used for processing and storing sensor data (notifying in the case of humidity, temperature, or ozone values over the established thresholds) and for image processing (notifying in the case of people or pets detected in the video). async function processSensorData(event: SQSEvent) {  for (const record of event.Records) {  const sensorData: SensorData = JSON.parse(record.body);  
// Store sensor data in DynamoDB  await dynamodb.put({  TableName: 'SensorData',  Item: sensorData  }).promise();  
// Check for anomalies using parameterized thresholds  if (sensorData.temperature > TEMPERATURE_THRESHOLD ||  sensorData.humidity > HUMIDITY_THRESHOLD ||  sensorData.ozone > OZONE_THRESHOLD) {  await sendNotification('Anomaly detected in sensor readings! ');  }  }  async function processImage(event: S3 Event) { ....  // Check for person or intruder  const detectedLabels =  
rekognitionResult.Labels?.map(label => label.Name) || [];  if (detectedLabels.includes('Person') || detectedLabels.includes  ('Pet')) {  await sendNotification('Presence Detected! ');  }  }
* **AWS SageMaker** is a fully managed service for building, training, and deploying machine learning models at scale over the data collected from the sensors or images, using machine learning models to make predictions or classifications. * **Amazon Rekognition** is an image and video analysis service that uses artificial intelligence to recognize objects, faces, scenes, text, and activities.