generating custom variables for aws-exports.js
See original GitHub issueIs your feature request related to a problem? Please describe.
I have a case where I have existing AWS resources and I’d like to integrate it with my React project.
The good thing about amplify is the ability to checkout an environment (e.g. amplify env checkout dev
) and an appropriate aws-exports.js
(in case of js project) will be automatically updated.
However, that only works when we create resources using amplify cli. It’d be really great if we can do it for existing resources.
Example: I have multiple Appsync API for multiple environments. It’d be great if I can save the API urls somewhere in amplify so it can be picked by my team members when they’re checking out one of our amplify envs
Describe the solution you’d like
If there’s a command to create a custom value for aws-exports.js
, that’d be great. e.g. amplify add variables --env dev
or something like that. and when the user executes amplify push
the variables should appear in aws-exports.js
We need a solution to generate the file without pushing the backend resources as well (if no changes in backend, we can use this command). Something like amplify push --config-only
.
The variables should not clash with existing variables generated by amplify.
Describe alternatives you’ve considered
An alternative that I can think of is to create the file manually and reference it using process.env
. However, this is inferior compared to amplify’s flexibility in swapping environment.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
@jkeys-ecg-nmsu Sorry if I’m not being clear…
So what I’m trying to achieve is to have 1 environment connect to 1 appsync API. Therefore, when I have prod and dev environments, I’d like to have a prod and dev appsync API too (2 appsync API in total)
However, those appsync APIs are not created by amplify (I’m using
serverless framework
). How can I put my appsync endpoint inaws-exports
if the appsync api is not created by amplify?Moreover, how can I put my Cognito Identity Pool ID (2 of them for dev and prod) in my
aws-exports
?Ultimately, I’d like to run
amplify checkout env dev
and get that configs (1 appsync endpoint and 1 cognito identity pool id) for devand when I
amplify checkout env prod
, I’d also like to get the config for prod (different endpoint and identity pool id).This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels for those types of questions.