Using The Vscode Claude Code Extension With Bedrock And Claude...

Using The Vscode Claude Code Extension With Bedrock And Claude...

Posted on Jan 2

• Originally published at bacchi.org

Lots of folks use the Claude IDE, or the Claude Code VSCode extension. Unfortunately, your prompts and completions are used (by default) to train Claude models. [0]

AWS Bedrock, on the other hand, doesn't use your prompts and completions to train any AWS models or give them to 3rd parties. [1]

In order to use the Claude Code VSCode extension with Bedrock and the Claude Sonnet 4.5 model, we need to perform these tasks:

To do this, we'll use Terraform to create our AWS IAM user and policies (but you could use the AWS console.)

Then we'll integrate this all together and verify it works as expected.

AWS Bedrock enables generating short lived API tokens via their SDK. [2] Claude Code does support two methods for automatic AWS credential refresh, but Bedrock API tokens is not one of them.

If it did support this feature it would be the best solution from a security perspective. Tokens would expire in 12 hours and when expired and the extension is used it would automatically refresh them.

Instead it only supports AWS SSO (or rather AWS Identity Center) for it's awsAuthRefresh option, or AWS IAM credentials for its awsCredentialsExport refresh methods. [3] This deficiency is a poor decision, or at least an oversight by the Claude Code development team.

Unfortunately, a more egregious issue is that they claim the above awsCredentialsExport refresh method is functional when it is not. Whether it's a regression or bug, or maybe never worked, I couldn't get it working within a couple hours. (Including time spent conversing with the Claude Code VSCode extension using a working AWS Profile and it couldn't suggest a workaround to this problem.) In addition to all these setbacks, using the Claude Code settings file (~/.claude/settings.json) didn't work either so I have to use the VSCode settings file to set all Claude Code extension configuration options.

Source: Dev.to