Hi Pulumi Folks, I would like to get the correct s...
# general
f
Hi Pulumi Folks, I would like to get the correct syntax for creating a AWS Cloudwatch MetricAlarm via Python in Pulumi. Things work when passing in one k/v pair into the
dimension
property, but passing in multiple k/v pairs results in only the last value being applied. Code is below:
cw_alarm = aws.cloudwatch.MetricAlarm(f'{instance._name}-disk',
alarm_description=f"This metric monitors ec2 disk utilization",
comparison_operator="GreaterThanOrEqualToThreshold",
evaluation_periods=1,
insufficient_data_actions=[],
dimensions= { 'Name':'InstanceId', 'Value':instance.id,
'Name':'Filesystem', 'Value':'/dev/root',
'Name':'MountPath', 'Value':'/',
},
metric_name="DiskSpaceUtilization",
namespace="AWS/EC2",
period=300,
statistic="Minimum",
threshold=80,
alarm_actions=[ alarm_action_arn ])
so, this works as expected:
dimensions= { 'Name':'InstanceId', 'Value':instance.id }
when adding more values, only the last one gets applied:
dimensions= { 'Name':'InstanceId', 'Value':instance.id,
'Name':'Filesystem', 'Value':'/dev/root',
'Name':'MountPath', 'Value':'/',
Got this fixed... The python dict format should be 
{ 'InstanceId' : instance.id }
 without the name/value tags.  Not sure why it worked with them. If anyone else comes across this issue:
dimensions= { 'InstanceId' : instance.id,
'Filesystem' : '/dev/root',
'MountPath' : '/',
}