Rebuilding Elastic Beanstalk environments - Amazon Elastic Beanstalk
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Rebuilding Elastic Beanstalk environments

Your Amazon Elastic Beanstalk environment can become unusable if you don't use Elastic Beanstalk functionality to modify or terminate the environment's underlying Amazon resources. If this happens, you can rebuild the environment to attempt to restore it to a working state. Rebuilding an environment terminates all of its resources and replaces them with new resources with the same configuration.

You can also rebuild terminated environments within six weeks (42 days) of their termination. When you rebuild, Elastic Beanstalk attempts to create a new environment with the same name, ID, and configuration.

Rebuilding a running environment

You can rebuild an environment through the Elastic Beanstalk console or by using the RebuildEnvironment API.

To rebuild a running environment (console)
  1. Open the Elastic Beanstalk console, and in the Regions list, select your Amazon Web Services Region.

  2. In the navigation pane, choose Environments, and then choose the name of your environment from the list.

    Note

    If you have many environments, use the search bar to filter the environment list.

  3. Choose Actions, and then choose Rebuild environment.

  4. Choose Rebuild.

Rebuilding a running environment creates new resources that have the same configuration as the old resources; however, the resource IDs are different, and any data on the old resources is not restored. For example, rebuilding an environment with an Amazon RDS database instance creates a new database with the same configuration, but does not apply a snapshot to the new database.

To rebuild a running environment with the Elastic Beanstalk API, use the RebuildEnvironment action with the Amazon CLI or the Amazon SDK.

$ aws elasticbeanstalk rebuild-environment --environment-id e-vdnftxubwq

Rebuilding a terminated environment

You can rebuild and restore a terminated environment by using the Elastic Beanstalk console, the EB CLI, or the RebuildEnvironment API.

Note

Unless you are using your own custom domain name with your terminated environment, the environment uses a subdomain of elasticbeanstalk.com. These subdomains are shared within an Elastic Beanstalk region. Therefore, they can be used by any environment created by any customer in the same region. While your environment was terminated, another environment could use its subdomain. In this case, the rebuild would fail.

You can avoid this issue by using a custom domain. See Your Elastic Beanstalk environment's Domain name for details.

Recently terminated environments appear in the application overview for up to an hour. During this time, you can view events for the environment in its dashboard, and use the Restore environment action to rebuild it.

To rebuild an environment that is no longer visible, use the Restore terminated environment option from the application page.

To rebuild a terminated environment (console)
  1. Open the Elastic Beanstalk console, and in the Regions list, select your Amazon Web Services Region.

  2. In the navigation pane, choose Applications, and then choose your application's name from the list.

    Note

    If you have many applications, use the search bar to filter the application list.

  3. Choose Actions, and then choose Restore terminated environment.

  4. Choose a terminated environment.

  5. Choose Restore.

Elastic Beanstalk attempts to create a new environment with the same name, ID, and configuration. If an environment with the same name or URL exists when you attempt to rebuild, the rebuild fails. Deleting the application version that was deployed to the environment will also cause the rebuild to fail.

If you use the EB CLI to manage your environment, use the eb restore command to rebuild a terminated environment.

$ eb restore e-vdnftxubwq

See eb restore for more information.

To rebuild a terminated environment with the Elastic Beanstalk API, use the RebuildEnvironment action with the Amazon CLI or the Amazon SDK.

$ aws elasticbeanstalk rebuild-environment --environment-id e-vdnftxubwq