恢复到以前的 S Amazon ystems Manager 文档版本 - Amazon ParallelCluster
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

恢复到以前的 S Amazon ystems Manager 文档版本

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

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

PCUI 基于无服务器架构构建,在大多数情况下,您可以在 Amazon 免费套餐类别中使用它。有关更多信息,请参阅 PCUI 成本

先决条件:

恢复到以前的 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