# Set Up Stakpak with Amazon Bedrock

## Prerequisites

1. [Install Stakpak](/docs/get-started/install-stakpak.md)
2. **AWS Account** with **Amazon Bedrock** access enabled in your **target region**.
3. **AWS Credentials** Configured locally via `~/.aws/credentials` or `~/.aws/config` (SSO, IAM user, or instance profile)
4. **Amazon Bedrock Model** Access: You must [request model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) in the AWS Console for the models you want to use (e.g., Anthropic Claude)

### Step 1: Install Stakpak

```
curl -sSL https://stakpak.dev/install.sh | sh
```

Full installation guide: [Install Stakpak](/docs/get-started/install-stakpak.md)

***

### Step 2: Configure AWS Credentials

Stakpak's Bedrock provider uses your local AWS credentials. Make sure one of these is set up:

* [#aws-named-profile-recommended](#aws-named-profile-recommended "mention")
* [#iam-user-access-keys](#iam-user-access-keys "mention")
* [#environment-variables](#environment-variables "mention")

And you need to have these [#required-iam-permissions](#required-iam-permissions "mention")

#### AWS Named Profile (Recommended)

If you already use `aws configure` or `AWS SSO`, you likely have profiles in `~/.aws/config`:

```ini
# ~/.aws/config
[profile my-bedrock-profile]
region = us-east-1
sso_start_url = https://my-org.awsapps.com/start
sso_region = us-east-1
sso_account_id = 123456789012
sso_role_name = PowerUserAccess
```

Log in to refresh your session:

```bash
aws sso login --profile my-bedrock-profile
```

#### IAM User Access Keys

```ini
# ~/.aws/credentials
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
```

#### Environment Variables

```bash
export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
export AWS_REGION="us-east-1"
```

#### Required IAM Permissions

Your IAM identity needs the following permissions for Bedrock:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Resource": "arn:aws:bedrock:*::foundation-model/*"
    }
  ]
}
```

{% hint style="info" %}
**Tip:** For tighter security, scope the `Resource` to the specific model(s) you'll use, e.g.: `arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-sonnet-4-20250514-v1:0`
{% endhint %}

***

### Step 3: Enable Model Access in AWS Console

Before Stakpak can call any model, you must request access in the Bedrock console:

1. Open the [Amazon Bedrock Console](https://console.aws.amazon.com/bedrock)
2. Navigate to **Model access** in the left sidebar
3. Click **Manage model access**
4. Select the models you want (e.g., **Anthropic -> Claude 4 Sonnet**)
5. Submit the request (most models are approved instantly)

***

### Step 4: Authenticate Stakpak with Bedrock

```
stakpak auth login --provider amazon-bedrock --profile bedrock --region us-east-1
```

{% hint style="danger" %}
Don't forget to choose the same region as where your bedrock model is enabled
{% endhint %}

***

## References

* [Install Stakpak](/docs/get-started/install-stakpak.md)
* [Configure Stakpak](/docs/get-started/configure-stakpak.md)
* [Profiles](/docs/how-it-works/profiles.md)
* [Configuration and credential file settings in the AWS CLI](https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-files.html)
* [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/)
* [Bedrock Model Access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stakpak.gitbook.io/docs/tutorial/set-up-stakpak-with-amazon-bedrock.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
