Feature request: allow to set AWS profile

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 6 comments · opened Feb 26, 2025 · closed May 5, 2025
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

I'd like to be able to configure Claude Code to use specific profile for performing queries to Bedrock.

The idea is to have it only for Claude Code, no matter of env variables set, this way you can work with one AWS account in your console and use another for sending queries to Bedrock.

View original on GitHub ↗

6 Comments

bcherny collaborator · 1 year ago

How do you set a profile? Is that fully controlled with env vars?

ChrisDryden · 1 year ago

Yes this can be fully controlled by env vars. You can run

export AWS_PROFILE=<PROFILENAME>

And it will map to the profiles in the aws config and it should be picked up by the SDK's

tomaszkiewicz · 1 year ago

No, this is not the case I'm talking about.

Provided that Claude Code can both write code as well as run the commands let's imagine the situation like that:

I develop some application and want to test it from my development environment.
Let's say app needs to access S3 bucket using specific AWS profile.

Without Claude Code I just set AWS_PROFILE and run that app, everything works just fine.

Now, I want to use Claude Code, but... I don't want it to use that AWS_PROFILE for reaching Bedrock - real life use case it that e.g. I want to use personal account for Bedrock billing and then develop against customer AWS account.

If I set AWS_PROFILE then both Claude Code and and my app will use that single profile, but I want them to use two separate ones.

So the feature is about introducing additional env variable like _CLAUDE_CODE_AWS_PROFILE_ which for Claude Code takes precedence over AWS_PROFILE.

This way I can set both like:

export CLAUDE_CODE_AWS_PROFILE=my-personal-account 
export AWS_PROFILE=dev
claude
// do all stuff

And now Claude Code bills my personal account, but every command that it executes uses "dev" profile.

Basically, during Bedrock client setup we want to do:

[pseudocode]

{
...,
profile = process.env.CLAUDE_CODE_AWS_PROFILE || process.env.AWS_PROFILE || '',
...,
bcherny collaborator · 1 year ago
cogwirrel · 1 year ago

Is there any way to set this env variable so it's just something claude itself uses for model access, but not have it propagate to the env that claude uses when it runs bash commands?

Currently it seems like if I want claude to deploy anything to AWS it'll always be bound to the same account that I'm using for bedrock.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.