From 43a6961ec506a4ae2fe7764eecd3f57a474b9664 Mon Sep 17 00:00:00 2001 From: Vasily Sovetov Date: Thu, 20 Jun 2024 11:03:15 +0300 Subject: [PATCH] ec2: Add RamMonitoring Instance attribute --- boto/ec2/connection.py | 9 ++++++++- boto/ec2/instance.py | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/boto/ec2/connection.py b/boto/ec2/connection.py index df4fce3754..9cddac8439 100644 --- a/boto/ec2/connection.py +++ b/boto/ec2/connection.py @@ -768,7 +768,8 @@ def run_instances(self, image_id, min_count=1, max_count=1, user_data=None, addressing_type=None, instance_type='m1.small', placement=None, kernel_id=None, ramdisk_id=None, - monitoring_enabled=False, subnet_id=None, + monitoring_enabled=False, ram_monitoring=False, + subnet_id=None, block_device_map=None, disable_api_termination=False, instance_initiated_shutdown_behavior=None, @@ -864,6 +865,10 @@ def run_instances(self, image_id, min_count=1, max_count=1, :param monitoring_enabled: Enable detailed CloudWatch monitoring on the instance. + :type ram_monitoring: bool + :param ram_monitoring: Enable RAM CloudWatch monitoring on + the instance. + :type subnet_id: string :param subnet_id: The subnet ID within which to launch the instances for VPC. @@ -1002,6 +1007,8 @@ def run_instances(self, image_id, min_count=1, max_count=1, params['RamdiskId'] = ramdisk_id if monitoring_enabled: params['Monitoring.Enabled'] = 'true' + if ram_monitoring: + params['RamMonitoring'] = 'true' if subnet_id: params['SubnetId'] = subnet_id if private_ip_address: diff --git a/boto/ec2/instance.py b/boto/ec2/instance.py index a09c2598f0..31f0d5fbd8 100644 --- a/boto/ec2/instance.py +++ b/boto/ec2/instance.py @@ -231,6 +231,7 @@ def __init__(self, connection=None): self.ami_launch_index = None self.monitored = False self.monitoring_state = None + self.ram_monitoring = None self.spot_instance_request_id = None self.subnet_id = None self.vpc_id = None @@ -373,6 +374,8 @@ def endElement(self, name, value, connection): if value == 'enabled': self.monitored = True self._in_monitoring_element = False + elif name == 'ramMonitoring': + self.ram_monitoring = value elif name == 'spotInstanceRequestId': self.spot_instance_request_id = value elif name == 'subnetId':