Reverting a configuration - Amazon AppConfig
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).

Reverting a configuration

During a deployment, you can mitigate situations where malformed or incorrect configuration data causes errors in your application by using automatic rollbacks (if an alarm triggers during a deployment) or by reverting the configuration data to the previous version (if a deployment successfully completed).

For automatic rollbacks, you can use a combination of Amazon AppConfig deployment strategies and Amazon CloudWatch alarms. Once configured, if one or more CloudWatch alarms go into the ALARM state during a deployment, Amazon AppConfig automatically rolls back your configuration data to the previous version, thereby preventing application outages or errors. To get started, see (Recommended) Configure permissions for automatic rollback.

Note

You can also roll back a configuration by calling the StopDeployment API operation while a deployment is still in progress.

For deployments that successfully complete, Amazon AppConfig also supports reverting configuration data to a previous version by using the AllowRevert parameter with the StopDeployment API operation. For some customers, reverting to a previous configuration after a successful deployment guarantees the data will be the same as it was before the deployment. Reverting also ignores alarm monitors, which may prevent a roll forward from progressing during an application emergency.

Important

If you call StopDeployment with the AllowRevert parameter enabled, Amazon AppConfig will revert the deployment only if the deployment succeeded within the last 72 hours. After 72 hours, the deployment can no longer be reverted. You must create a new deployment.

Here's a breakdown of the StopDeployment functionality based on different situations.

  1. If StopDeployment is called on an in-progress deployment, the resulting deployment state will be ROLLED_BACK.

  2. If StopDeployment (with AllowRevert) is called on an in-progress deployment, the resulting deployment state will be ROLLED_BACK.

  3. If StopDeployment is called on a completed deployment, a BadRequestException will be thrown.

  4. If StopDeployment (with AllowRevert) is called on a completed deployment, the resulting deployment state will be REVERTED.

  5. If StopDeployment (with AllowRevert) is called on a completed deployment after 72 hours, a BadRequestException will be thrown.

You can use the Amazon CLI to call the StopDeployment operation with the AllowRevert parameter. Here's an example Amazon CLI command that includes the AllowRevert parameter.

aws appconfig stop-deployment \ --application-id 339ohji \ --environment-id 54j1r29 \ --deployment-number 2 \ --allow-revert