恢复到以前的 AWS Systems Manager 文档版本 - AWS ParallelCluster

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

恢复到以前的 AWS Systems Manager 文档版本

了解如何恢复到以前的 AWS Systems Manager 文档版本。有关 SSM 文档的更多信息,请参阅 AWS Systems Manager 用户指南 中的 AWS Systems Manager 文档

使用 AWS ParallelCluster 命令行界面 (CLI) 或 API 时,您只需为创建或更新 AWS ParallelCluster 映像和集群时创建的 AWS 资源付费。有关更多信息,请参阅 AWS 使用的服务 AWS ParallelCluster

AWS ParallelCluster UI 基于无服务器的架构而构建,在大多数情况下,可以在 AWS Free Tier 类别中使用。有关更多信息,请参阅 AWS ParallelCluster UI 成本

先决条件:

恢复到以前的 SSM 文档版本

  1. 在您的终端中,运行以下命令以获取您拥有的现有 SSM 文档的列表。

    $ aws ssm list-documents --document-filter "key=Owner,value=Self"
  2. 将一个 SSM 文档恢复到以前的版本。在此示例中,我们将 SessionManagerRunShell 文档恢复到以前版本。您可以使用 SSM SessionManagerRunShell 文档自定义您启动的每个 SSM Shell会话。

    1. 通过运行以下命令找到 SessionManagerRunShellDocumentVersion 参数:

      $ aws ssm describe-document --name "SSM-SessionManagerRunShell" { "Document": { "Hash": "...", "HashType": "Sha256", "Name": "SSM-SessionManagerRunShell", "Owner": "123456789012", "CreatedDate": "2023-02-20T19:04:32.390000+00:00", "Status": "Active", "DocumentVersion": "1", "Parameters": [ { "Name": "linuxcmd", "Type": "String", "Description": "The command to run on connection...", "DefaultValue": "if [ -d '/opt/parallelcluster' ]; then source /opt/parallelcluster/cfnconfig; sudo su - $cfn_cluster_user; fi; /bin/bash" } ], "PlatformTypes": [ "Windows", "Linux", "MacOS" ], "DocumentType": "Session", "SchemaVersion": "1.0", "LatestVersion": "2", "DefaultVersion": "1", "DocumentFormat": "JSON", "Tags": [] } }

      最新版本为 2

    2. 通过运行以下命令,恢复到以前的版本:

      $ aws ssm delete-document --name "SSM-SessionManagerRunShell" --document-version 2
  3. 再次运行 describe-document 命令,验证文档版本是否已恢复:

    $ aws ssm describe-document --name "SSM-SessionManagerRunShell" { "Document": { "Hash": "...", "HashType": "Sha256", "Name": "SSM-SessionManagerRunShell", "Owner": "123456789012", "CreatedDate": "2023-02-20T19:04:32.390000+00:00", "Status": "Active", "DocumentVersion": "1", "Parameters": [ { "Name": "linuxcmd", "Type": "String", "Description": "The command to run on connection...", "DefaultValue": "if [ -d '/opt/parallelcluster' ]; then source /opt/parallelcluster/cfnconfig; sudo su - $cfn_cluster_user; fi; /bin/bash" } ], "PlatformTypes": [ "Windows", "Linux", "MacOS" ], "DocumentType": "Session", "SchemaVersion": "1.0", "LatestVersion": "1", "DefaultVersion": "1", "DocumentFormat": "JSON", "Tags": [] } }

    最新版本为 1