yera.cli.setup_handlers.aws

AWS Bedrock provider setup handler.

Symbols

class AWSSetup — Handler for configuring AWS Bedrock provider connections.

AWSSetup

Handler for configuring AWS Bedrock provider connections.

This class manages the lifecycle of AWS authentication setup, supporting automatic discovery of local ~/.aws/ profiles and manual interactive configuration of profiles and regions.

Methods

detect_config — Attempts to automatically detect AWS configuration from local profiles.
ask_for_config — Interactively prompts the user to configure an AWS Bedrock connection.
validate — Validates the provided AWS connection configuration.

AWSSetup.detect_config

detect_config() → AWSConnection | None

Attempts to automatically detect AWS configuration from local profiles.

Scans the local environment for AWS profiles. If profiles are found, the user is prompted to select one, and the handler attempts to detect the associated region.

Returns

type: AWSConnection | None

An AWSConnection instance if a profile and region are successfully identified; otherwise, None.

AWSSetup.ask_for_config

ask_for_config() → AWSConnection | None

Interactively prompts the user to configure an AWS Bedrock connection.

Prompts the user for an AWS profile name (allowing for the default chain) and a target AWS region.

Returns

type: AWSConnection | None

An AWSConnection instance containing the user-provided profile and region, or None if the user declines the setup.

AWSSetup.validate

validate(
    config: AWSConnection,
) → None

Validates the provided AWS connection configuration.

Verifies the validity of the credentials by attempting to call the AWS Security Token Service (STS) get_caller_identity method. This ensures that the profile and region are correctly configured and that the credentials are active.

Parameters

config
type: AWSConnection

The AWS connection configuration to validate.

Raises

ValueError

If the AWS credentials cannot be validated via STS due to BotoCore or Client errors.