# Configuring AWS metric alarm using newly created scaling policy ARN

**URL:** <https://forum.ansible.com/t/configuring-aws-metric-alarm-using-newly-created-scaling-policy-arn/15666>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [July 14, 2014, 6:42pm UTC](https://forum.ansible.com/t/configuring-aws-metric-alarm-using-newly-created-scaling-policy-arn/15666 "2014-07-14T18:42:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claire\_Lee](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Claire\_Lee](https://forum.ansible.com/u/Claire_Lee)\
**Post date:** [July 14, 2014, 6:42pm UTC](https://forum.ansible.com/t/configuring-aws-metric-alarm-using-newly-created-scaling-policy-arn/15666/1 "2014-07-14T18:42:20Z")

</div>

Hi guys, I’m still pretty new to Ansible and was wondering if you could answer a question I have.

I’m trying to create an AWS scaling policy and attach a metric alarm to it. From what I understand, the ec2\_metric\_alarm module needs the ARN of the scaling policy so that it can associate itself with it. However, I can’t seem to get the ARN after creating a new scaling policy from the ec2\_scaling\_policy module’s output. Currently I’m trying to register the result of the ec2\_scaling policy module. For example, my playbook looks something like this:

> - name: Create scaling policy and associate it with autoscaling group  
> ec2\_scaling\_policy:  
> state: present  
> region: us-east-1  
> name: “test-scaleup-policy”  
> adjustment\_type: “ChangeInCapacity”  
> asg\_name: “test-asg”  
> scaling\_adjustment: 1  
> min\_adjustment\_step: 1  
> cooldown: 300  
> register: sp\_result
> 
> - name: Debug result of scaling policy creation  
> debug: var=sp\_result
> 
> - name: Create metric alarm and associate it with autoscaling policy  
> action:  
> module: ec2\_metric\_alarm  
> state: present  
> alarm\_actions: [“{{ sp\_result.arn }}”]  
> etc…

The debug module prints this:

> TASK: [Debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> ok: [localhost] =\> {  
> “sg\_result”: {  
> “changed”: false,  
> “invocation”: {  
> “module\_args”: “”,  
> “module\_name”: “ec2\_scaling\_policy”  
> }}}

According to [this merged pull request](https://github.com/ansible/ansible/pull/7829), the ARN should be included in the data the module returns. Am I trying to capturing this information in the wrong way, e.g. using register when I should be using something else? Otherwise, is there something else I should be doing?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [July 14, 2014, 7:10pm UTC](https://forum.ansible.com/t/configuring-aws-metric-alarm-using-newly-created-scaling-policy-arn/15666/2 "2014-07-14T19:10:30Z")

</div>

What version of Ansible are you running? The above PR was merged into devel and will be included in 1.7, however it is not yet available in 1.6.x.

---

<div class="post-metadata">

**Author:** ![Claire\_Lee](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Claire\_Lee](https://forum.ansible.com/u/Claire_Lee)\
**Post date:** [July 14, 2014, 8:47pm UTC](https://forum.ansible.com/t/configuring-aws-metric-alarm-using-newly-created-scaling-policy-arn/15666/3 "2014-07-14T20:47:37Z")

</div>

D’oh, looks like I was still on 1.6.6. Using the devel branch now and it works, thanks!
