# To get list of Amazon regions and availability zones

**URL:** <https://forum.ansible.com/t/to-get-list-of-amazon-regions-and-availability-zones/25677>\
**Category:** Ansible Developer\
**Created:** [October 4, 2017, 6:47am UTC](https://forum.ansible.com/t/to-get-list-of-amazon-regions-and-availability-zones/25677 "2017-10-04T06:47:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sshobha379](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sshobha379](https://forum.ansible.com/u/sshobha379)\
**Post date:** [October 4, 2017, 6:47am UTC](https://forum.ansible.com/t/to-get-list-of-amazon-regions-and-availability-zones/25677/1 "2017-10-04T06:47:23Z")

</div>

Hi team,

I would like to get a list of Amazon regions and availability zones using ansible . Please let me know if this can be done using ansible

Regards,  
Shobha

---

<div class="post-metadata">

**Author:** ![Gregory\_Dulin](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@Gregory\_Dulin](https://forum.ansible.com/u/Gregory_Dulin)\
**Post date:** [October 6, 2017, 2:31am UTC](https://forum.ansible.com/t/to-get-list-of-amazon-regions-and-availability-zones/25677/2 "2017-10-06T02:31:14Z")

</div>

`  
Shobha,

`I don't think there's a module for that yet, but you can use the`command` module to call the aws cli. It’ll give you a JSON string that you can parse with a from\_json filter:

`

- name: “Get AWS regions json”  
command: aws ec2 describe-regions  
register: describe\_regions

- name: “Parse AWS regions into aws\_regions”  
set\_fact:  
aws\_regions: “{{ describe\_regions.stdout | from\_json }}”

- debug: var=aws\_regions  
`  
(untested)

You should be able to do something similar for the Availability Zones too.
