amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

Switch Ionic app to use a different Mobile Hub project? #131

Open ryaa opened 6 years ago

ryaa commented 6 years ago

I created a new Ionic mobile application using this starter template - see https://github.com/ionic-team/starters/tree/master/ionic-angular/official/aws. During setup it created a new Mobile Hub project and associated the ionic app with it (the appropriate details were recorded into awsmobilejs directory files and src/aws-export.js). The problem is that there is already a Mobile Hub project configured with the existing Cognito Pool which needs to be used by this ionic app. I manually changed src/aws-export.js file params to use it which worked fine until i needed to publish the app to S3. After running awsmobile publish (which also pulled the backend config) all the manual settings were replaced.

Question - is there anyway to switch the existing mobile app to a different Mobile Hub project? I reviewed awsmobile cli commands and issue tracker and could not find how to do this.

UnleashedMind commented 6 years ago

Yes, by executing the init command with the project id of the Mobile Hub project that you wanted to switch to. awsmobile init <mobile-hub-project-id> you can find the mobile hub project id after you click open the mobile hub project in the web console, and the id will be in the url. https://console.aws.amazon.com/mobilehub/home?#/<mobile-hub-projectid>/build