Note
This lookup plugin is part of the amazon.aws collection (version 9.5.1).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install amazon.aws. You need further requirements to be able to use this lookup plugin, see Requirements for details.
To use it in a playbook, specify: amazon.aws.aws_service_ip_ranges.
The below requirements are needed on the local controller node that executes this lookup.
This describes keyword parameters of the lookup. These are the values key1=value1, key2=value2 and so on in the following examples: lookup('amazon.aws.aws_service_ip_ranges', key1=value1, key2=value2, ...) and query('amazon.aws.aws_service_ip_ranges', key1=value1, key2=value2, ...)
Parameter | Comments |
|---|---|
ipv6_prefixes string added in amazon.aws 2.1.0 | When |
region string | The AWS region to narrow the ranges to. Examples include |
service string | The service to filter ranges by. Options include |
vars:
ec2_ranges: "{{ lookup('aws_service_ip_ranges', region='ap-southeast-2', service='EC2', wantlist=True) }}"
tasks:
- name: "use list return option and iterate as a loop"
ansible.builtin.debug: msg="{% for cidr in ec2_ranges %}{{ cidr }} {% endfor %}"
# "52.62.0.0/15 52.64.0.0/17 52.64.128.0/17 52.65.0.0/16 52.95.241.0/24 52.95.255.16/28 54.66.0.0/16 "
- name: "Pull S3 IP ranges, and print the default return style"
ansible.builtin.debug: msg="{{ lookup('aws_service_ip_ranges', region='us-east-1', service='S3') }}"
# "52.92.16.0/20,52.216.0.0/15,54.231.0.0/17"
Key | Description |
|---|---|
Return value string | Comma-separated list of CIDR ranges. Returned: success |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_service_ip_ranges_lookup.html