Does `sst deploy` read from `env` files early enou...
# help
r
Does
sst deploy
read from
env
files early enough to set a profile? Just checking out the docs here, https://docs.serverless-stack.com/packages/cli#aws-profile realizing I would like to swap profiles. If I have a
AWS_PROFILE
in my
.env
or
.env.production
will that get picked up or does it need to get set prior to running the command
AWS_PROFILE=production npx sst deploy
t
I believe people have profile in their .env
r
so does that mean that
.env.local
would work? seems like its not.
sst start
or
sst deploy
another dev is testing here actually haha doesnt look like its working
Looks like it will pick up the
AWS_PROFILE
if its an existing environmental variable, but doesnt look like dotenv loading is going applied
so @thdxr or @Frank I am curious what your thoughts are on this. We have finally moved from using our personal AWS accounts to per user company sandboxes. So each dev has a default profile already, likely hooked to their personal AWS account. However now everyone will want to swap over to their company sandbox when working on company specific projects. Do you recommend we all use the AWS CLI and swap profiles there (global AWS_PROFILE swapping) or is there a way within a SST project to let is know which profile to use? The docs talk about using
AWS_PROFILE
in commands, however this doesn't work great as most commands are in a
package.json
as a script. Each developer will have a different profile name so we can't put this in there and have it in source control. I would think if
AWS_PROFILE
in
.env.local
worked that might be the cleanest way.
t
can you have everyone follow a convention that names their personal profile as
AWS_PROFILE=company-personal
the nice thing about that is it prevents people from having to think about .env files and accidentally doing sst start in the wrong env
Copy code
[profile ironbay-dev]
sso_start_url = <https://ironbay.awsapps.com/start>
sso_region = us-east-2
sso_account_id = 280826753141
sso_role_name = AdministratorAccess
region = us-east-2
credential_process = aws-sso-util credential-process --profile ironbay-dev
This is my personal aws account but I still give it a generic
ironbay-dev
name
instead of
ironbay-thdxr
which is what it actually is
r
Alright that's fair, another possible solution is to try to standardize profile names.
So in that case we would then be forcing that profile in all our package.json scripts ?
t
yeah that's what I do
r
Do you know how would that play in with seed deploys? We just started down that path so I am not too experienced. Does it do
npm run deploy
or do all its own
npx sst
commands
t
I believe for sst projects it calls sst directly
but @Frank knows for sure, I'm less familiar with seed
r
Alright, so this may not be horrible. if devs want to use a different profile they could just call
sst
commands directly with
npx
and baking profile into scripts will keep people from deploying to the wrong place. just need everyone to make a profile to follow a standard. Probably the simplest solution.