get_regions
The get_regions method is provided so that as a module developer, you never need to worry about what regions you need or want to target. All you need to do is write your module as if every single time it runs, it runs against a list of regions. You can use get_regions to fetch that list of regions and you only need to provide it with an AWS service name. The line get_regions('EC2') will return all regions that support the EC2 service.
If the user has set session regions with the set_regions command, then get_regions('EC2') will return only the regions that support EC2 and are in the list of session regions. For this reason, you never really need to think about regions as a module developer, you just need to assume that there could ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access