Immutable solution version
Error after running `list_foundation_models`
Complete solution
Teaches how to error after running `list_foundation_models`. Based on a real issue report and its verified fix.
The problem
Issue aws-samples/amazon-bedrock-workshop#20 (closed, 25 comments): I receive the following error after running this line boto3_bedrock.list_foundation_models() in https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/00Intro/bedrockboto3setup.ipynb ``` NoCredentialsError Traceback (most recent call last) Cell In[11], line 1 ----> 1 boto3bedrock.listfoundationmodels() File [~/Downloads/repos/bedrock/.venv/lib/python3.11/site-packages/botocore/client.py:530]([a local notebook file path]]/...
What to do
NoCredentialsError from listfoundationmodels does not mean the client failed to build; boto3 creates the client fine and only fetches credentials lazily at request time. Verify with aws sts get-caller-identity (run aws configure from a real terminal, not a notebook cell, since notebook cells are not interactive). If you get AccessDenied instead, your account needs Bedrock model access: AWS Console > Bedrock > Model access, enable the models. Set AWSDEFAULTREGION to a region where Bedrock is enabled and AWSPROFILE to your configured profile. BEDROCKASSUME_ROLE is only needed if you must assume a different role than your default identity for Bedrock calls.
Evidence
In the GitHub issue gh:aws-samples/amazon-bedrock-workshop#20 (https://github.com/aws-samples/amazon-bedrock-workshop/issues/20), the problem reported was: Issue aws-samples/amazon-bedrock-workshop#20 (closed, 25 comments): I receive the following error after running this line boto3_bedrock.list_foundation_models() in https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/00Intro/bedrockboto3setup.ipynb ``` NoCredentialsError Traceback (most recent call last) Cell In[11], line 1 ----> 1 boto3bedrock.listfoundationmodels() File [~/Downloads/repos/bedrock/.venv/lib/python3.11/site-packages/botocore/client.py:530]([a local notebook file path]]/... The verified resolution was: NoCredentialsError from listfoundationmodels does not mean the client failed to build; boto3 creates the client fine and only fetches credentials lazily at request time. Verify with aws sts get-caller-identity (run aws configure from a real terminal, not a notebook cell, since notebook cells are not interactive). If you get AccessDenied instead, your account needs Bedrock model access: AWS Console > Bedrock > Model access, enable the models. Set AWSDEFAULTREGION to a region where Bedrock is enabled and AWSPROFILE to your configured profile. BEDROCKASSUME_ROLE is only needed if you must assume a different role than your default identity for Bedrock calls.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_7nnPcQRe47scgm2m6VkqoA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Error after running `list_foundation_models` <span>— Vectle</span></a>