Registry / aws / aws-cdk-region-info

aws-cdk-region-info

JSON →
library2.259.0pypypi✓ verified 85d ago

The `aws-cdk-region-info` library provides a comprehensive directory of AWS region-specific information, such as service principal names for IAM policies, S3 static website endpoints, and other essential regional facts. As a core component of the AWS Cloud Development Kit (CDK) v2, it enables CDK applications to dynamically adapt to regional differences. The library is actively maintained and receives frequent updates, typically alongside new AWS CDK releases, with the current version being 2.250.0.

pip install aws-cdk-region-info
INSTALL
IMPORT
SIG · AWS-CDK-REGION-INF
A
aws-cdk-region-info
awspythonv2.259.0
Install
2.4s avg
Import
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.259.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 23.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.4s · import 0.000s · 24MB
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RegionInfo
from aws_cdk import region_info # ... info = region_info.RegionInfo.get("us-east-1")
from aws_cdk.region_info import RegionInfo # Not the standard import pattern in Python CDK
The standard Python CDK import convention is to import the module and access classes via the module alias.
Fact
from aws_cdk import region_info # ... endpoint = region_info.Fact.find("ap-northeast-1", region_info.FactName.S3_STATIC_WEBSITE_ENDPOINT)
from aws_cdk.region_info.Fact import find # Incorrect submodule access
Accessing Fact and FactName directly via the main region_info module is the idiomatic way.

This quickstart demonstrates how to retrieve standard region information using `RegionInfo.get()` and its attributes, as well as how to use `Fact.find()` for specific facts. It also includes an example of how to register custom region facts for new or overridden data.

import os from aws_cdk import region_info # Get information for a specific region us_east_1_info = region_info.RegionInfo.get("us-east-1") print(f"S3 Static Website Endpoint for us-east-1: {us_east_1_info.s3_static_website_endpoint}") # Get a service principal for a region s3_service_principal = us_east_1_info.service_principal("s3.amazonaws.com") print(f"S3 Service Principal for us-east-1: {s3_service_principal}") # Find a specific fact for a region using Fact.find() # Example: Get the domain suffix for a China region cn_north_1_domain_suffix = region_info.Fact.find("cn-north-1", region_info.FactName.DOMAIN_SUFFIX) print(f"Domain Suffix for cn-north-1: {cn_north_1_domain_suffix}") # Override or add a custom fact (e.g., for a new or hypothetical region) # This is for demonstration; normally you'd implement IFact class MyCustomFact: def __init__(self, region, name, value): self.region = region self.name = name self.value = value @region_info.jsii.implements(region_info.IFact) class CustomEndpointFact(MyCustomFact): pass custom_region = "bermuda-triangle-1" custom_endpoint_fact = CustomEndpointFact( region=custom_region, name=region_info.FactName.S3_STATIC_WEBSITE_ENDPOINT, value="s3-website.bermuda-triangle-1.nowhere.com" ) region_info.Fact.register(custom_endpoint_fact) # Retrieve the custom fact retrieved_custom_endpoint = region_info.RegionInfo.get(custom_region).s3_static_website_endpoint print(f"Custom S3 Static Website Endpoint for {custom_region}: {retrieved_custom_endpoint}")
Debug
Known issues
breakingSpecific versions of `aws-cdk-region-info` (e.g., 2.200.1 up to 2.232.2) have experienced a regression causing a `Cannot find module 'aws-cdk-lib/core/lib/errors'` error at runtime due to internal dependency issues within the CDK ecosystem. This can completely block CDK application execution.
fix
Downgrade `aws-cdk-region-info` to a known working version (e.g., 2.199.0) or upgrade to a patched version that resolves the internal module resolution issue. Always test upgrades in a controlled environment.
affects: 2.200.1 - 2.232.2 (and potentially others within this range)
gotchaThe AWS CDK CLI (e.g., `cdk synth`, `cdk deploy`) overrides any user-set `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION` environment variables. If you rely on these for specific deployments, the CLI's behavior might lead to unintended targets.
fix
Instead of `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION`, define your own custom environment variables (e.g., `MY_DEPLOY_ACCOUNT`, `MY_DEPLOY_REGION`) and use them programmatically within your CDK application for stack `env` properties. For region-specific resource lookups or imports, explicitly specify the `env` property in your CDK stacks.
affects: All AWS CDK v2 versions
gotchaWhile `aws-cdk-region-info` aims to be comprehensive, new AWS regions or very specific service endpoints might initially be missing or have outdated facts. Relying solely on the built-in data might lead to `None` values or incorrect behavior for bleeding-edge features or newly launched regions.
fix
If you encounter missing or incorrect data, you can temporarily override or supply new facts using `region_info.Fact.register()`. It's also recommended to report such findings as a GitHub issue to the AWS CDK team so it can be fixed in future releases.
affects: All versions, particularly for newly launched AWS regions or services.
Errors
Common errors & fixes
Error: Cannot find module 'aws-cdk-lib/core/lib/errors'
An internal dependency resolution issue within specific versions of `aws-cdk-region-info` prevents it from finding a required module from `aws-cdk-lib/core`.
fix
Check your `aws-cdk-region-info` version. If it's within the affected range (e.g., 2.200.1 - 2.232.2), try downgrading to a stable preceding version (e.g., 2.199.0) or upgrading to a version released after the fix was applied.
cdk synth / cdk deploy uses the wrong AWS account or region for deployment.
The AWS CDK CLI overwrites `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION` if set as shell environment variables. Additionally, 'environment-agnostic' stacks might default to your AWS CLI's configured profile.
fix
Avoid using `CDK_DEFAULT_ACCOUNT` or `CDK_DEFAULT_REGION` directly. Instead, explicitly define the `env` property (account and region) for your CDK `Stack` instances in your code. For custom overrides, define and use your own environment variables (e.g., `MY_ACCOUNT`, `MY_REGION`) within your application code.
region_info.RegionInfo.get('some-new-region').some_fact returns None or incorrect value.
The built-in database of regional facts might not yet include information for very new AWS regions or specific, recently launched service features, or might contain outdated information.
fix
Verify the fact's existence and correctness in the official AWS documentation. If missing or incorrect, use `region_info.Fact.register()` to programmatically inject or override the specific fact for your application. Consider contributing the correction to the AWS CDK project via a GitHub issue.
Upgrade
Version history
2.259.0latest on PyPI · released Jun 12, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.9 or higher for AWS CDK v2 compatibility.
Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
2
Resources
aws-cdk-region-info — pip install aws-cdk-region-info · libregistry