Skip to content

Latest commit

 

History

History

examples

Running example notebooks

To run these example notebooks, please follow these instructions.

  1. Fireup Amazon SageMaker Studio.
  2. Launch a Jupyter Notebook with the following runtime configurations:

bedrock-ds-1.png

  1. Downoad Bedrock Python SDK from here
  2. Unzip the SDK archive to access .whl files.
  3. Move the .whl files in to a new directory.
  4. Now start executing each cell in the Jupyter Notebooks and you should be in the game.

IAM Policy setup for invoking Bedrock APIs.

Create an IAM policy like this in the policy editor:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "BedrockPolicySid",
            "Effect": "Allow",
            "Action": "bedrock:ListFoundationModels",
            "Resource": "*"
        }
    ]
}

And give this policy a name called Bedrock Policy bedrock-iam-1

Then go ahead and add this to the your SageMaker Execution Role, like this: bedrock-iam-2

bedrock-iam-3

bedrock-iam-4

Now when you execute the bedrock.list_foundation_models() it runs without any errors.

bedrock-iam-4