From 3512ff49586865f0aae255b611e42235a0ea518e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20G=C3=BCnsche?= Date: Wed, 18 Oct 2023 10:45:17 +0200 Subject: [PATCH] check if AWS CLI is configured for account access --- ask_bedrock/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ask_bedrock/main.py b/ask_bedrock/main.py index 5cc4fac..20fc2b5 100644 --- a/ask_bedrock/main.py +++ b/ask_bedrock/main.py @@ -39,6 +39,13 @@ def converse(context: str): config = create_config(None) put_config(context, config) + sts = boto3.client('sts') + try: + sts.get_caller_identity() + except Exception as e: + click.secho(f"Credentials are NOT valid: {e}. You may need to check your local AWS CLI configuration.") + return + start_conversation(config)