配置 Amazon AppConfig 删除保护
Amazon AppConfig 提供了一个账户设置,有助于防止用户无意中删除正在使用的环境和配置文件。Amazon AppConfig 监控对 GetLatestConfiguration 和 GetConfiguration 的调用,并在 60 分钟间隔(默认设置)内跟踪这些调用中包含了哪些配置文件和环境。在该时间间隔内被访问的任何配置配置文件或环境将被视为活动状态。如果您尝试删除活动的配置配置文件或环境,Amazon AppConfig 将返回错误。如果需要,您可以使用 DeletionProtectionCheck 参数绕过此错误。有关更多信息,请参阅 绕过或强制删除保护检查。
使用控制台配置删除保护
使用以下过程通过 Amazon Systems Manager 控制台配置删除保护。
配置删除保护(控制台)
访问 https://console.aws.amazon.com/systems-manager/appconfig/
,打开 Amazon Systems Manager 控制台。 -
在导航窗格中,选择 Settings(设置)。
-
使用切换开关启用或禁用删除保护。
-
对于保护期,将活动资源的定义设置为 15 到 1440 分钟之间。
-
单击应用。
使用 Amazon CLI 配置删除保护
使用以下过程通过 Amazon CLI 配置删除保护。将以下命令中的 value 替换为您要在环境中使用的值。
注意
在开始之前,我们建议您更新到 Amazon CLI 的最新版本。有关更多信息,请参阅《Amazon Command Line Interface User Guide》中的 Install or update to the latest version of the Amazon CLI。
配置删除保护(CLI)
-
运行以下命令以查看当前删除保护设置。
aws appconfig get-account-settings -
运行以下命令以启用或禁用删除保护。指定
false以禁用删除保护,或指定true以启用它。aws appconfig update-account-settings --deletion-protection Enabled=value -
可以将默认间隔增加到最多 24 小时。运行以下命令以指定新间隔。
aws appconfig update-account-settings --deletion-protection Enabled=true,ProtectionPeriodInMinutes=a number between 15 and 1440