+# elastic ip module issues with AWS region
+I'm trying to associate an eip to an instance with the eip execution module. It works fine in us-east-1, but not in us-west-2. The ip in question [4.10.23.1] is in fact in us-west-2 and is currently associated to that minion.
+Here is the template, should work in any region
+{% import 'global/settings.sls' as global with context %}
+{% if global.eip is defined %}
+# we have to use the execution module for this
+# as there is no state module for eip's
+ec2.associate_eip_address:
+ - name: boto_ec2.associate_eip_address
+ - instance_id: {{ global.instance_id }}
+ - public_ip: {{ global.eip }}
+ public_ip: {{ global.eip }},
+ allow_reassociation: 'true',
+ region: {{ global.region }},
+ instance_id: {{ global.instance_id }}
+this renders correctly on the minion and sets the region:
+US-WEST-2-minion # salt-call cp.get_template salt://ec2/elastic-ip.sls /dev/stdout
+# we have to use the execution module for this
+# as there is no state module for eip's
+ec2.associate_eip_address:
+ - name: boto_ec2.associate_eip_address
+ - instance_id: i-08572e62c97063af7
+ allow_reassociation: 'true',
+ instance_id: i-08572e62c97063af7
+yet when running the sls, I get this message, which is what I believe I'd get if I'd set the region wrong. FYI, this works fine in us-east-1 (with us-east-1 elastic ips).
+US-WEST-2-minion # salt-call -l info state.apply ec2.elastic-ip (snipped out irrelevant lines)
+[INFO ] Executing state module.run for boto_ec2.associate_eip_address
+[ERROR ] EC2ResponseError: 400 Bad Request
+<?xml version="1.0" encoding="UTF-8"?>
+<Response><Errors><Error><Code>AuthFailure</Code><Message>The address '4.10.23.1' does not belong to you.</Message></Error></Errors><RequestID>c754cba8-6bbb-4903-bd5f-d98fd8850261</RequestID></Response>
+[INFO ] Completed state [boto_ec2.associate_eip_address] at time 13:16:08.429428 duration_in_ms=444.563