本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
還原至先前的AWS系統管理員文件版本
瞭解如何還原至先前的AWS系統管理員文件版本。如需 SSM 文件的詳細資訊,請參閱AWS系統管理員使用指南中的AWS系統管理員文件。
使用命AWS ParallelCluster令列介面 (CLI) 或 API 時,您只需為建立或更新AWS ParallelCluster映像和叢集時建立的AWS資源付費。如需詳細資訊,請參閱AWS 使用的服務 AWS ParallelCluster。
AWS ParallelClusterUI 建立在無伺服器架構上,在大多數情況下,您可以在AWS免費方案類別中使用它。如需詳細資訊,請參閱AWS ParallelClusterUI 成本。
事前準備:
-
AWS 帳戶具有管理 SSM 文件的權限。
-
AWS CLI已安裝並設定。
還原為先前的 SSM 文件版本
-
在終端機中,執行下列命令以取得您擁有的現有 SSM 文件清單。
$
aws ssm list-documents --document-filter "key=Owner,value=Self"
-
將 SSM 文件還原為先前的版本。在這個例子中,我們恢復到
SessionManagerRunShell
文檔的先前版本。您可以使用 SSMSessionManagerRunShell
文件來自訂您起始的每個 SSM 殼層工作階段。-
執行下列命令尋找的
DocumentVersion
參數:SessionManagerRunShell
$
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
。 -
執行下列命令以回復至先前的版本:
$
aws ssm delete-document --name
"SSM-SessionManagerRunShell"
--document-version2
-
-
再次執行
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
。