Issue creating Cloudwatch alarms

I’m trying to create some alarms using the metrics module. I’m using pretty much the exact example given in the docs

  • name: create alarm
    ec2_metric_alarm:
    state: present
    region: us-west-2
    name: “cpu-low”
    metric: “CPUUtilization”
    namespace: “AWS/EC2”
    statistic: Average
    comparison: “<=”
    threshold: 5.0
    period: 300
    evaluation_periods: 3
    unit: “Percent”
    description: "This will alarm when a bamboo slave’s cpu usage average is lower than 5% for 15 minutes "
    dimensions: {‘InstanceId’:‘{{ansible_ec2_instance_id}}’}
    alarm_actions: [‘{{alarm_sns}}’]

But I get a failure from boto saying that the security token is unexpected.

File “/usr/lib/python2.7/dist-packages/boto/regioninfo.py”, line 62, in connect

return self.connection_cls(region=self, **kw_params)
TypeError: init() got an unexpected keyword argument ‘security_token’

I’ve tried setting and unsetting the access and secret keys but this makes no difference. I’m running from a checkout,

ansible 1.8 (devel 707474a43a) last updated 2014/10/22 15:22:23 (GMT +100)
lib/ansible/modules/core: (detached HEAD 88b73afcbe) last updated 2014/10/22 17:32:44 (GMT +100)
lib/ansible/modules/extras: (detached HEAD a0df36c6ab) last updated 2014/10/22 17:33:05 (GMT +100)
v2/ansible/modules/core: (detached HEAD cb69744bce) last updated 2014/10/22 17:32:17 (GMT +100)
v2/ansible/modules/extras: (detached HEAD 8a4f07eecd) last updated 2014/10/22 17:32:32 (GMT +100)
configured module search path = None

And have boto 2.33 installed.

Anyone seen this or know what might be up?

Thanks,

Steve.

Hi Stephen,

That’s a very odd error, since the boto docs (http://boto.readthedocs.org/en/latest/ref/cloudwatch.html) show that security_token is, in fact, a valid parameter for the connection. Looking at some older versions of the doc, that param was not listed in the cloudwatch connection class so you may want to verify there are not multiple versions of boto installed.

Alternatively, since I see you’re not running this as a local_action or “delegate_to: localhost”, make sure you have the correct version of boto installed on the system where the module is executing, assuming your “- hosts:” list is not localhost.

Also, a traceback is always a bug, please file a ticket on this in the ansible/ansible-modules-core repo so we can catch it.