Skip to content

yggdrasil.enums.aws

aws

AWS region enum + region-from-text inference.

:class:AWSRegion is a str-backed enum of every public AWS region code, so a region round-trips as a plain string everywhere (URLs, SigV4 scopes, console hosts) while still being a typed, comparable member.

:meth:AWSRegion.from_text recovers a region embedded in arbitrary text — people routinely bake it into bucket names (acme-dls3-eu-central-1-p), so when no region is configured the S3 layer falls back to sniffing it out of the bucket name before defaulting to us-east-1.

AWSRegion

Bases: str, Enum

partition property

partition: str

The AWS partition this region belongs to (aws / aws-us-gov / aws-cn).

from_ classmethod

from_(value: Any, *, default: Any = ...) -> 'Optional[AWSRegion]'

Coerce value (an :class:AWSRegion, a region string, or None) to a member. Unknown / None returns default if given, else raises.

from_text classmethod

from_text(text: Any, *, default: Any = None) -> 'Optional[AWSRegion]'

Find an AWS region code embedded in text (e.g. a bucket name like acme-dls3-eu-central-1-p), or default if none is present.

Matches a region only when it stands as a whole, delimiter-bounded token (so eu-central-12 / ...-1foo don't false-positive), and prefers the longest code at a position (ap-southeast-1 over ap-south-1).