question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

generating custom variables for aws-exports.js

See original GitHub issue

Is 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:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kkesley-shinecommented, Nov 5, 2019

@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 in aws-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 dev

and when I amplify checkout env prod, I’d also like to get the config for prod (different endpoint and identity pool id).

0reactions
github-actions[bot]commented, May 25, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatic build-time generation of Amplify config
Amplify supports the automatic build-time generation of the Amplify config aws-exports.js file. By turning off full stack CI/CD deployments, you enable your ...
Read more >
Environment variables - AWS Amplify Hosting
Environment variables are key-value pairs that are available at build time. These configurations can be anything, including the following:
Read more >
Environment variables to configure the AWS CLI
Environment variables provide another way to specify configuration options and credentials, and can be useful for scripting or temporarily setting a named ...
Read more >
Working with Custom Environment Variables in the AWS ...
You can set command-level custom environment variables as you run a command in your AWS Cloud9 development environment. To test this behavior, create...
Read more >
Configuring build settings - AWS Amplify Hosting
In the Environment variables section, choose Manage variables. The procedure for configuring the environment variable varies depending on whether you are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found