Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Creating & Managing Multiple Serverless AWS Environments Using the AWS Amplify CLI

    nader dabitnader dabit

    In this video we show how to spin up new environments using the AWS Amplify CLI to test out new features & then merge the new features back into a main AWS Amplify environment.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson




    Instructor: To get started, we'll initialize a new Amplify project by running amplify init. The specifics of the environment won't matter for the purposes of this demo, so feel free to set your environment up however you like. Now that the Amplify project has been initialized, we'll go ahead and add authentication by running amplify add auth.

    Next, we'll run amplify push to create the authentication resource in our account. Now, we'll run amplify status to see the current environment that we're working in and the categories that are currently enabled. I'm currently in the dev environment, and the only category that I have enabled is auth.

    Now, let's initialize a new environment from our existing environment. To do so, we'll run amplify init. When asked if we want to choose an existing environment, we'll choose no. Next, we're prompted for the environment name. This will be the name of the new environment based on our existing environment. I'll give this environment a name of API feature.

    After the new environment has been initialized, we should be able to run amplify status and see the current environment set to the new environment that we just created. We can also run amplify ENV list to view all of the current environments available in our project. From within the new API feature environment, let's add a new API. To do so, we'll run amplify add API and add a GraphQL API.

    After the API has been added, we should be able to run amplify status and see two categories in our project. To initialize these features in our account, we can now run amplify push. After the resources have been created in our account, we should be able to run amplify status and see the two categories with the operation of no change.

    We can now check out our original environment to merge the new API feature. To do so, run amplify ENV checkout and the name of your environment. After checking out our original environment, we should be able to run amplify status and see a new category added to our environment.

    To create this new resource in our account, we can run amplify push. To remove the API feature development environment, we can now run amplify ENV remove API feature. This will also prompt us to ask us do we also want to remove all of the resources of the environment from the cloud. Choose yes to delete these resources in your account.

    When we now run amplify ENV list, we should see that the API feature environment has been removed.