Menu
AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)

Rebuilding AWS Elastic Beanstalk Environments

Your Elastic Beanstalk environment can become unusable if you don't use Elastic Beanstalk functionality to modify or terminate the environment's underlying AWS 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.

  2. Navigate to the management page for your environment.

  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 AWS CLI or the AWS SDK.

$ aws elasticbeanstalk rebuild-environment 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.

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.

  2. Choose your application.

  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 AWS CLI or the AWS SDK.

$ aws elasticbeanstalk rebuild-environment e-vdnftxubwq