|
| 1 | +--- |
| 2 | +title: Anthropic Bedrock |
| 3 | +subtitle: Use Anthropic Claude models via AWS Bedrock with your own AWS resources |
| 4 | +slug: providers/model/anthropic-bedrock |
| 5 | +--- |
| 6 | + |
| 7 | +**What is Anthropic Bedrock?** |
| 8 | + |
| 9 | +Amazon Bedrock is a fully managed service that provides access to foundation models from leading AI companies, including Anthropic's Claude models. With Bedrock, you can use Claude models through AWS infrastructure, benefiting from enterprise-grade security, regional data residency, and seamless integration with your existing AWS environment. |
| 10 | + |
| 11 | +**Custom Anthropic Bedrock Integration with Vapi:** |
| 12 | + |
| 13 | +Vapi's Anthropic Bedrock integration allows you to connect your own AWS Bedrock resources to power voice assistants with Claude models. This enables you to maintain full control over your AWS billing, use your own rate limits, and ensure data stays within your AWS environment. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +Before configuring Anthropic Bedrock with Vapi, ensure you have: |
| 18 | + |
| 19 | +- An active AWS account with Bedrock access enabled |
| 20 | +- Model access granted for Anthropic Claude models in your Bedrock console |
| 21 | +- IAM permissions to create roles and policies |
| 22 | + |
| 23 | +## Configuration steps |
| 24 | + |
| 25 | +<Steps> |
| 26 | + <Step title="Create an IAM Role in AWS"> |
| 27 | + Create a new IAM role that Vapi will assume to access your Bedrock resources. |
| 28 | + |
| 29 | + 1. Go to the **IAM Console** in AWS |
| 30 | + 2. Navigate to **Roles** and click **Create role** |
| 31 | + 3. Select **Custom trust policy** as the trusted entity type |
| 32 | + 4. Add the trust policy from the next step |
| 33 | + |
| 34 | + <Note> |
| 35 | + Choose a descriptive name for your role, such as `VapiBedrockRole`, so you can easily identify its purpose. |
| 36 | + </Note> |
| 37 | + </Step> |
| 38 | + |
| 39 | + <Step title="Attach the Trust Policy"> |
| 40 | + Configure the trust policy to allow Vapi's AWS account to assume this role. Use the following trust policy: |
| 41 | + |
| 42 | + ```json title="Trust Policy" |
| 43 | + { |
| 44 | + "Version": "2012-10-17", |
| 45 | + "Statement": [ |
| 46 | + { |
| 47 | + "Effect": "Allow", |
| 48 | + "Principal": { |
| 49 | + "AWS": "arn:aws:iam::533267069243:root" |
| 50 | + }, |
| 51 | + "Action": "sts:AssumeRole", |
| 52 | + "Condition": { |
| 53 | + "StringEquals": { |
| 54 | + "sts:ExternalId": "YOUR_EXTERNAL_ID" |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + ] |
| 59 | + } |
| 60 | + ``` |
| 61 | + |
| 62 | + <Warning> |
| 63 | + **About External ID**: The External ID provides an additional layer of security for cross-account access. You can either: |
| 64 | + - Provide your own External ID when creating the Vapi credential |
| 65 | + - Let Vapi generate one for you (returned in `authenticationArtifact.externalId`) |
| 66 | + |
| 67 | + If Vapi generates the External ID, you must update this trust policy with the generated value after creating the credential. |
| 68 | + </Warning> |
| 69 | + </Step> |
| 70 | + |
| 71 | + <Step title="Attach the Permissions Policy"> |
| 72 | + Create and attach a permissions policy that grants access to Bedrock model invocation. |
| 73 | + |
| 74 | + <Tabs> |
| 75 | + <Tab title="Broad Access"> |
| 76 | + Use this policy to grant access to all Anthropic models across all regions: |
| 77 | + |
| 78 | + ```json title="Permissions Policy (All Models)" |
| 79 | + { |
| 80 | + "Version": "2012-10-17", |
| 81 | + "Statement": [ |
| 82 | + { |
| 83 | + "Effect": "Allow", |
| 84 | + "Action": [ |
| 85 | + "bedrock:InvokeModel", |
| 86 | + "bedrock:InvokeModelWithResponseStream" |
| 87 | + ], |
| 88 | + "Resource": [ |
| 89 | + "arn:aws:bedrock:*::foundation-model/anthropic.*", |
| 90 | + "arn:aws:bedrock:*:*:inference-profile/us.anthropic.*" |
| 91 | + ] |
| 92 | + } |
| 93 | + ] |
| 94 | + } |
| 95 | + ``` |
| 96 | + </Tab> |
| 97 | + <Tab title="Restrictive Access"> |
| 98 | + Use this policy to limit access to specific models and regions: |
| 99 | + |
| 100 | + ```json title="Permissions Policy (Specific Models)" |
| 101 | + { |
| 102 | + "Version": "2012-10-17", |
| 103 | + "Statement": [ |
| 104 | + { |
| 105 | + "Effect": "Allow", |
| 106 | + "Action": [ |
| 107 | + "bedrock:InvokeModel", |
| 108 | + "bedrock:InvokeModelWithResponseStream" |
| 109 | + ], |
| 110 | + "Resource": [ |
| 111 | + "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-5-sonnet-*", |
| 112 | + "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-7-sonnet-*", |
| 113 | + "arn:aws:bedrock:us-east-1:*:inference-profile/us.anthropic.claude-3-5-sonnet-*", |
| 114 | + "arn:aws:bedrock:us-east-1:*:inference-profile/us.anthropic.claude-3-7-sonnet-*" |
| 115 | + ] |
| 116 | + } |
| 117 | + ] |
| 118 | + } |
| 119 | + ``` |
| 120 | + |
| 121 | + <Tip> |
| 122 | + Replace `us-east-1` with your preferred AWS region. You can also add or remove specific model versions based on your needs. |
| 123 | + </Tip> |
| 124 | + </Tab> |
| 125 | + </Tabs> |
| 126 | + |
| 127 | + To attach the policy: |
| 128 | + 1. In the IAM Console, go to **Policies** and click **Create policy** |
| 129 | + 2. Select **JSON** and paste your chosen policy |
| 130 | + 3. Name the policy (e.g., `VapiBedrockInvokePolicy`) |
| 131 | + 4. Attach the policy to your IAM role |
| 132 | + </Step> |
| 133 | + |
| 134 | + <Step title="Create the Vapi Credential"> |
| 135 | + Use the Vapi API to create a credential with your AWS role information: |
| 136 | + |
| 137 | + ```bash title="Create Credential via API" |
| 138 | + curl -X POST "https://api.vapi.ai/credential" \ |
| 139 | + -H "Authorization: Bearer YOUR_VAPI_API_KEY" \ |
| 140 | + -H "Content-Type: application/json" \ |
| 141 | + -d '{ |
| 142 | + "provider": "anthropic-bedrock", |
| 143 | + "region": "us-east-1", |
| 144 | + "authenticationPlan": { |
| 145 | + "type": "aws-sts", |
| 146 | + "roleArn": "arn:aws:iam::YOUR_AWS_ACCOUNT_ID:role/VapiBedrockRole", |
| 147 | + "externalId": "your-optional-external-id" |
| 148 | + } |
| 149 | + }' |
| 150 | + ``` |
| 151 | + |
| 152 | + | Field | Description | |
| 153 | + |-------|-------------| |
| 154 | + | `provider` | Must be `anthropic-bedrock` | |
| 155 | + | `region` | AWS region where Bedrock is enabled (e.g., `us-east-1`) | |
| 156 | + | `authenticationPlan.type` | Must be `aws-sts` for role assumption | |
| 157 | + | `authenticationPlan.roleArn` | The ARN of the IAM role you created | |
| 158 | + | `authenticationPlan.externalId` | Optional: Your chosen External ID. If omitted, Vapi generates one | |
| 159 | + |
| 160 | + <Note> |
| 161 | + If you omit `externalId`, Vapi will generate one and return it in the response under `authenticationArtifact.externalId`. You must then update your IAM trust policy with this value. |
| 162 | + </Note> |
| 163 | + </Step> |
| 164 | + |
| 165 | + <Step title="Update Trust Policy with Generated External ID (if applicable)"> |
| 166 | + If Vapi generated an External ID for you, update your IAM role's trust policy: |
| 167 | + |
| 168 | + 1. Go to the **IAM Console** and select your role |
| 169 | + 2. Click the **Trust relationships** tab |
| 170 | + 3. Click **Edit trust policy** |
| 171 | + 4. Replace `YOUR_EXTERNAL_ID` with the value from `authenticationArtifact.externalId` |
| 172 | + 5. Save the changes |
| 173 | + |
| 174 | + Your trust policy should now look like this: |
| 175 | + |
| 176 | + ```json title="Updated Trust Policy" {10} |
| 177 | + { |
| 178 | + "Version": "2012-10-17", |
| 179 | + "Statement": [ |
| 180 | + { |
| 181 | + "Effect": "Allow", |
| 182 | + "Principal": { |
| 183 | + "AWS": "arn:aws:iam::533267069243:root" |
| 184 | + }, |
| 185 | + "Action": "sts:AssumeRole", |
| 186 | + "Condition": { |
| 187 | + "StringEquals": { |
| 188 | + "sts:ExternalId": "vapi-generated-external-id-here" |
| 189 | + } |
| 190 | + } |
| 191 | + } |
| 192 | + ] |
| 193 | + } |
| 194 | + ``` |
| 195 | + </Step> |
| 196 | +</Steps> |
| 197 | + |
| 198 | +## Example credential configuration |
| 199 | + |
| 200 | +Here is a complete example of a Vapi credential configuration for Anthropic Bedrock: |
| 201 | + |
| 202 | +```json title="Credential Configuration" |
| 203 | +{ |
| 204 | + "provider": "anthropic-bedrock", |
| 205 | + "region": "us-east-1", |
| 206 | + "authenticationPlan": { |
| 207 | + "type": "aws-sts", |
| 208 | + "roleArn": "arn:aws:iam::123456789012:role/VapiBedrockRole", |
| 209 | + "externalId": "my-secure-external-id" |
| 210 | + } |
| 211 | +} |
| 212 | +``` |
| 213 | + |
| 214 | +## Benefits of using Anthropic Bedrock |
| 215 | + |
| 216 | +**Enterprise security:** |
| 217 | +- Data residency control with regional deployments |
| 218 | +- Enterprise-grade security and compliance (SOC 2, HIPAA eligible, etc.) |
| 219 | +- Private VPC connectivity options through AWS |
| 220 | + |
| 221 | +**Custom rate limits:** |
| 222 | +- Use your own AWS Bedrock quotas and rate limits |
| 223 | +- Avoid shared resource constraints |
| 224 | +- Predictable costs and billing through AWS |
| 225 | + |
| 226 | +**AWS ecosystem integration:** |
| 227 | +- Seamless integration with existing AWS infrastructure |
| 228 | +- Use AWS CloudWatch for monitoring and logging |
| 229 | +- Leverage AWS IAM for fine-grained access control |
| 230 | + |
| 231 | +## Troubleshooting |
| 232 | + |
| 233 | +### Common error: "Access Denied" |
| 234 | +- **Cause**: The IAM role trust policy doesn't allow Vapi to assume the role |
| 235 | +- **Solution**: Verify the trust policy includes Vapi's AWS account ID (`533267069243`) and the correct External ID |
| 236 | + |
| 237 | +### Common error: "Invalid External ID" |
| 238 | +- **Cause**: The External ID in your trust policy doesn't match the one used by Vapi |
| 239 | +- **Solution**: Check the `authenticationArtifact.externalId` in your credential and update your trust policy accordingly |
| 240 | + |
| 241 | +### Common error: "Model access denied" |
| 242 | +- **Cause**: The IAM permissions policy doesn't grant access to the requested model, or model access isn't enabled in Bedrock |
| 243 | +- **Solution**: |
| 244 | + 1. Verify the permissions policy includes the correct model ARNs |
| 245 | + 2. Ensure you've enabled access to the model in the AWS Bedrock console |
| 246 | + |
| 247 | +### Common error: "Region not supported" |
| 248 | +- **Cause**: The specified region doesn't have Bedrock or the requested model available |
| 249 | +- **Solution**: Use a supported region such as `us-east-1`, `us-west-2`, or `eu-west-1` |
0 commit comments