'How to create multiple environments using AWS amplify

my app uses vue3, vuetify and amplify with rest api, dynamodb. Things were working as expected until I started getting errors in API calls that I couldn't explain. I deleted the "dev" enviornment using AWS console. When I tried to recreate the env using "amplify push", I got error saying "The specified bucket does not exist". So, I created a new env called "test" using "amplify init". Now "amplify push" is successful but the vue app seems to be pointing to older "dev" config.

I have two questions.

First, any thoughts on why I got "bucket doesn't exist" error.

Second, how do I get the vue app to use the new config that matches "test" env



Solution 1:[1]

It's actually very simple:

Goal: Have 1 environment for production and 1 environment for us to develop.

  • Create a new environment by doing: amplify env add, when prompted with "Select the authentication method you want to use", use "Amplify Admin UI". Give this env the name "prod"
  • Delete previous environment (ONLY IF YOU NEED TO DELETE IT) with name "staging, by typing amplify console and selecting "amplify console":
  • Create a new environment by doing: amplify env add and give this env the name "dev"

When ever you create a new environment, you switch to it automatically. You can check your current env, by doing Amplify status

Source and more info about managing the environment: Here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arturo