opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Support an Opencode-specific AWS profile

Open wilcosec opened this issue 2 months ago • 7 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I would like to use Opencode with Amazon Bedrock in an AWS account different than the one I'm deploying to. Setting AWS_PROFILE system wide forces the two to be the same.

Rational: I have one AWS account specifically designated for Bedrock use (and Sagemaker and other AI tools). It is not the account we use as our test bed.

I see other tools solve with with a custom set of environment variables. For example:

export AWS_PROFILE="sandbox"
export AWS_REGION="us-west-2"
export OPENCODE_AWS_PROFILE="bedrock"
export OPENCODE_AWS_REGION="us-east-1"

By prioritizing OPENCODE_ environment variables, users could easily work with services in one AWS account while Opencode uses Amazon Bedrock in another.

wilcosec avatar Nov 12 '25 20:11 wilcosec

Yeah someone else asked for this w/ vertex

I think this shouldnt be too difficult but wed wanna do it across the board prolly

rekram1-node avatar Nov 12 '25 21:11 rekram1-node

Can you use a tool like dotenvx as a work around? I use Bedrock and load the AWS_PROFILE and AWS_REGION from the .env that way: dotenvx run -- opencode

thoroc avatar Nov 12 '25 21:11 thoroc

It's a simple workaround with AWS_PROFILE=bedrock opencode. Just thought it would be nice for me (and probably others) if Opencode had a superset of environment variables as I described above. I got the idea from the Zed IDE, and it's nice to just set it and forget it.

wilcosec avatar Nov 12 '25 23:11 wilcosec

yeah I think it's fair

rekram1-node avatar Nov 13 '25 16:11 rekram1-node

Agree with the author. In our setup also we have different account setup for bedrock while the default setup points to regular account.

sandipwane avatar Nov 14 '25 16:11 sandipwane

Yeah this should be easy to add, I can work on it if I get a chance soon

rekram1-node avatar Nov 15 '25 01:11 rekram1-node

If this merits a different issue, let me know and I'll open one.

Something that I'd find helpful in this scenario is being able to specify what profile to use for this provider in the config file (global or project level).

Shackelford-Arden avatar Dec 17 '25 01:12 Shackelford-Arden