Skip to main content

A simple package for retrieving a list of AWS regions.

Project description

AWSToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

This module provides a simple method for retrieving and processing AWS region information. This is a core component for all of the tools in our AWS Toolbox.

Features

  • Fetching AWS Regions:

    • Retrieve a list of all AWS regions, optionally including/excluding regions based on account opt-in status.
    • Supports fetching detailed information about each region.
  • Region Details:

    • Fetch geographical location descriptions for specific AWS regions from the AWS Systems Manager (SSM) Parameter Store.
    • Utilizes concurrent threading for enhanced performance when fetching multiple region details.
  • Filtering:

    • Apply include and exclude filters to customize the list of AWS regions returned.

Functions

Public Functions

  • get_region_list
    • Retrieves a list of AWS regions.
    • Parameters:
      • include_list: Optional list of regions to include.
      • exclude_list: Optional list of regions to exclude.
      • all_regions: Boolean flag to include all regions (default: True).
      • details: Boolean flag to return detailed information about each region (default: False).
      • profile_name: String to specify the name of the profile to use.
    • Returns:
      • If details=True: Sorted list of dictionaries containing detailed region information.
      • If details=False: Sorted list of region names as strings.
    • Raises:
      • RegionListingError: If an error occurs during region retrieval or processing.

Usage

This module is designed to be used as part of the wolfsoftware.get-aws-regions package. The primary function, get_region_list, allows flexible retrieval and customization of AWS region information based on user-defined criteria.

Example

from wolfsoftware.get_aws_regions import get_region_list

# Example usage: Retrieve all regions and print their names
regions = get_region_list(details=False)
print("AWS Regions:", regions)

# Example usage: Retrieve detailed information for selected regions
detailed_regions = get_region_list(include_list=['us-west-1', 'us-east-1'], details=True)
for region in detailed_regions:
    print(f"Region: {region['RegionName']}, Location: {region['GeographicalLocation']}")

Notes

  • Ensure AWS credentials are properly configured for API access.
  • Error handling is integrated to manage exceptions during AWS operations.
  • Threading is utilized for efficient concurrent operations when fetching region details.

For further details and customization options, refer to the function docstrings and the module's implementation.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wolfsoftware_get_aws_regions-0.1.1.tar.gz (9.6 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page