Hi@akhtar,
You can monitor your EC2 instances with the help of the boto3 module. The below-given script shows how to monitor instances.
import sys
import boto3
ec2 = boto3.client('ec2')
if sys.argv[1] == 'ON':
response = ec2.monitor_instances(InstanceIds=['INSTANCE_ID'])
else:
response = ec2.unmonitor_instances(InstanceIds=['INSTANCE_ID'])
print(response)