DEV Community

Cover image for 4 Ways to run amplify project from existing Git repo.
thatIITgirl
thatIITgirl

Posted on

4 Ways to run amplify project from existing Git repo.

Aws-amplify is great to develop and air an application in minutes. However, we end up messing with our application's configuration in a way it doesn't let us push in the cloud. Either we can try fixing the existing app or we could clone it fresh and run it again.

Option1 : amplify remove "service"

where service could be anything like auth, storage, etc. It will reinstate the backend without that service.

Option 2: amplify pull

This command will pull the last updated "not messed up" stack of resources in your local :D. But beware! local code might not find the resources which got purged during the amplify pull.

Option 3 : Clone Git your repo

If there is no way out, you might need to clone the repo, when you'll try to run it there might be an error thrown

"aws-export error"

Now, Make a file name aws-exports.js in src dir and copy the existing aws-exports.js from your old running project. Also, remove "// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify."
it must be running !!! :D
Alt Text

Option 4 : Clone Git someone else's repo

Here you might not be having the aws-exports.js to copy from, Use following command, it will direct you to the sequential steps to create an IAM user and more.

amplify init --app https://github.com/..repo..

There are a few points we may use as best practices while developing with aws-amplify like the following

* Always use amplify push when a new resource is created.
* Set up the GitHub CI/CD as soon as the project Skelton is set up as if it breaks, it is easier to trace the last messed up commit and rollback.
* Check Package.json often that also messes the build of amplify.

Top comments (0)