| 1 | --- |
| 2 | title: "How to Configure Amazon Bedrock with Continue" |
| 3 | slug: ../bedrock |
| 4 | sidebarTitle: "Amazon Bedrock" |
| 5 | --- |
| 6 | |
| 7 | <Tip> |
| 8 | **Discover Amazon Bedrock models [here](https://hub.continue.dev/amazon)** |
| 9 | </Tip> |
| 10 | |
| 11 | <Info> |
| 12 | Get started with [Amazon Bedrock](https://aws.amazon.com/bedrock/) |
| 13 | </Info> |
| 14 | |
| 15 | ## Configuration |
| 16 | |
| 17 | <Tabs> |
| 18 | <Tab title="YAML"> |
| 19 | ```yaml title="config.yaml" |
| 20 | models: |
| 21 | - name: <MODEL_NAME> |
| 22 | provider: bedrock |
| 23 | model: <MODEL_ID> |
| 24 | env: |
| 25 | region: us-east-1 |
| 26 | profile: bedrock |
| 27 | roles: |
| 28 | - chat |
| 29 | ``` |
| 30 | </Tab> |
| 31 | <Tab title="JSON (Deprecated)"> |
| 32 | ```json title="config.json" |
| 33 | { |
| 34 | "models": [ |
| 35 | { |
| 36 | "title": "<MODEL_NAME>", |
| 37 | "provider": "bedrock", |
| 38 | "model": "<MODEL_ID>", |
| 39 | "region": "us-east-1", |
| 40 | "profile": "bedrock" |
| 41 | } |
| 42 | ] |
| 43 | } |
| 44 | ``` |
| 45 | </Tab> |
| 46 | </Tabs> |
| 47 | |
| 48 | <Info> |
| 49 | **Check out a more advanced configuration [here](https://hub.continue.dev/amazon/us-anthropic-claude-sonnet-4-20250514-v1?view=config)** |
| 50 | </Info> |
| 51 | |
| 52 | ## How to Enable Prompt Caching with Amazon Bedrock |
| 53 | |
| 54 | Bedrock allows Claude models to cache tool payloads, system messages, and chat |
| 55 | messages between requests. Enable this behavior by adding |
| 56 | `promptCaching: true` under `defaultCompletionOptions` in your model |
| 57 | configuration. |
| 58 | |
| 59 | ```yaml title="config.yaml" |
| 60 | models: |
| 61 | - name: <MODEL_NAME> |
| 62 | provider: bedrock |
| 63 | model: <MODEL_ID> |
| 64 | defaultCompletionOptions: |
| 65 | promptCaching: true |
| 66 | ``` |
| 67 | |
| 68 | Prompt caching is not supported in JSON configuration files, so use the YAML syntax above to enable it. |
| 69 | |
| 70 | ## How to Set Up Authentication for Amazon Bedrock |
| 71 | |
| 72 | Authentication will be through temporary or long-term credentials in |
| 73 | `~/.aws/credentials` under a configured profile (e.g. "bedrock"). |
| 74 | |
| 75 | ```title="~/.aws/credentials |
| 76 | [bedrock] |
| 77 | aws_access_key_id = abcdefg |
| 78 | aws_secret_access_key = hijklmno |
| 79 | aws_session_token = pqrstuvwxyz # Optional: means short term creds. |
| 80 | ``` |
| 81 | |
| 82 | You can also use an AWS `accessKeyId` and `secretAccessKey` for authentication instead of a local credentials profile. |
| 83 | |
| 84 | <Tabs> |
| 85 | <Tab title="YAML"> |
| 86 | ```yaml title="config.yaml" |
| 87 | models: |
| 88 | - name: <MODEL_NAME> |
| 89 | provider: bedrock |
| 90 | model: <MODEL_ID> |
| 91 | env: |
| 92 | region: us-east-1 |
| 93 | accessKeyId: ${{ secrets.AWS_ACCESS_KEY_ID }} # can also enter key inline here for local assistants |
| 94 | secretAccessKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # can also enter key inline here for local assistants |
| 95 | roles: |
| 96 | - chat |
| 97 | ``` |
| 98 | </Tab> |
| 99 | <Tab title="JSON (Deprecated)"> |
| 100 | ```json title="config.json" |
| 101 | { |
| 102 | "models": [ |
| 103 | { |
| 104 | "title": "<MODEL_NAME>", |
| 105 | "provider": "bedrock", |
| 106 | "model": "<MODEL_ID>", |
| 107 | "region": "us-east-1", |
| 108 | "accessKeyId": "<YOUR_ACCESS_KEY_ID>", |
| 109 | "secretAccessKey": "<YOUR_SECRET_ACCESS_KEY>" |
| 110 | } |
| 111 | ] |
| 112 | } |
| 113 | ``` |
| 114 | </Tab> |
| 115 | </Tabs> |
| 116 | |
| 117 | ## How to Configure Custom Imported Models with Amazon Bedrock |
| 118 | |
| 119 | To setup Bedrock using custom imported models, add the following to your config file: |
| 120 | |
| 121 | <Tabs> |
| 122 | <Tab title="YAML"> |
| 123 | ```yaml title="config.yaml" |
| 124 | models: |
| 125 | - name: <MODEL_NAME> |
| 126 | provider: bedrockimport |
| 127 | model: <MODEL_ID> |
| 128 | env: |
| 129 | region: us-west-2 |
| 130 | profile: bedrock |
| 131 | modelArn: arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX |
| 132 | ``` |
| 133 | </Tab> |
| 134 | <Tab title="JSON (Deprecated)"> |
| 135 | ```json title="config.json" |
| 136 | { |
| 137 | "models": [ |
| 138 | { |
| 139 | "title": "<MODEL_NAME>", |
| 140 | "provider": "bedrockimport", |
| 141 | "model": "<MODEL_ID>", |
| 142 | "modelArn": "arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX", |
| 143 | "region": "us-west-2", |
| 144 | "profile": "bedrock" |
| 145 | } |
| 146 | ] |
| 147 | } |
| 148 | ``` |
| 149 | </Tab> |
| 150 | </Tabs> |
| 151 | |
| 152 | Authentication will be through temporary or long-term credentials in |
| 153 | ~/.aws/credentials under a configured profile (e.g. "bedrock"). |
| 154 | |
| 155 | ```title="~/.aws/credentials |
| 156 | [bedrock] |
| 157 | aws_access_key_id = abcdefg |
| 158 | aws_secret_access_key = hijklmno |
| 159 | aws_session_token = pqrstuvwxyz # Optional: means short term creds. |
| 160 | ``` |