* Which Category is your question related to? *
AWS Amplify cli general
* What AWS Services are you utilizing? *
N/A
* Provide additional details e.g. code snippets *
Is there a way to provide additional environment-specific variables that would be updated (e.g. in aws-exports.js
) when using amplify env checkout
?
For example, we manually configure an OAuth domain for each of our environments. We would want to have this as an environment-specific variable which would be available from aws-exports.js
(or some other place) which would automatically update when we do amplify env checkout
. (Currently aws-exports.js
doesn't even contain the environment name, so we cannot create a manual environment map based on it.)
Amplify CLI does not support environment specific variable in the configuration file.
Amplify Auth category supports Hosted UI, but doesn't support different redirect url for different environment.
I will mark this as a enhancement and put this in our backlog to get this prioritized
This really needs to be super high priority. AWS can't expect Amplify to be a production ready tool set when basic workflows like true multi environment support without manual work aren't supported. :(
When implementing, one useful thing would be to allow using the environment-specific variables as parameters for custom CF stacks.
You should also be able to define them in multiple files. Some variables may be secrets that we don't want to commit to our version control, while others we want there.
Any updates on this?
Its actually really annoying and error prone to do this management manually upon merge or checkouts.
I am even considering a simple dynamodb table for environment specific config to get around this issue.
(That's how desperate I am)
In the interim we're going to add a separate map which uses some unique field (e.g. aws_user_pools_id
) from aws-exports.js as a key. This is of course less than ideal, as the environment name is not present in aws-exports.js and it exposes all environments' variables in all builds.
Please let us know once you have added it and released in a new version of the amplify cli
Is there any update on this? I also need to support multiple environments with different configurations.
For me I setup my clients resources under my own subscription then would like a way to migrate the
resources for them to their subscription. I can get it
It seems though that amplify is not really at a point where this is possible. Especially if you can't have different Auth domains / environment.
@conkman Did you take a look at this - https://aws-amplify.github.io/docs/cli-toolchain/quickstart#environments--teams for your multi-environments need?
I've found a workaround. If you have added and deployed cloudfront hosting you can determine the environment name with:
const deliveryBucket: string = awsconfig.aws_content_delivery_bucket;
const env = deliveryBucket.substring(deliveryBucket.lastIndexOf("-") + 1);
You can now use the env name to load further custom environment-specific variables.
+1 - would like easy way to print the environment name on a banner on top of UI .
Currently the only viable option for me is to:
Parameters
section of CF template for given lambdaEnvironment
sectionamplify push
update the team-provider-info.json
: in function
category of corresponding lambda please add key-value pair ("parametername": value) which will be used in given envThe above approach let us keep track of different values for custom env variables but has some problems:
Parameters
section of CF template)Unfortunately manual edition of team-provider-info.json
does not work 100% of time for built-in amplify parameters like DOMAINWHITELIST (i tried to change the value after env add
and before push
but unfortunately the empty value was used, was able to change the EMAILMESSAGE though, probably depends if the new value is used in the same push or the next one).
Would be good to skip the "configuration wizzard" entiretly after env add
and have some standard way of doing it non-interactively.
does this issue apply to parameters.json
as well? I think this is really necessary.
for example, in production environment, we can have:
"ElasticSearchInstanceCount": 5,
"ElasticSearchInstanceType": "m5.4xlarge.elasticsearch"
It doesn't make sense to use that config for dev env, though..
@kkesley-shine AFAIK parameters.json
is common for all envs. I tend to avoid it and I only declare parameters directly in the CF template. This way can use different values. Would be good though to be able to keep multiple files with parameters somewhere.
@psporysz However, I think there are things that can only be overridden by parameters.json
such as parameters in https://aws-amplify.github.io/docs/cli-toolchain/graphql#configurable-parameters. Which includes ElasticSearchInstanceCount
and ElasticSearchInstanceType
Any update on this one?
@Rolando-Barbella we're working on this now, unsure of a date but will try to come back soon with something close.
thanks for the update @dabit3
any news on it?
Any updates or ETA on this?
Most helpful comment
This really needs to be super high priority. AWS can't expect Amplify to be a production ready tool set when basic workflows like true multi environment support without manual work aren't supported. :(