

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 以前の AWS Systems Manager ドキュメントバージョンに戻す
<a name="tutorials_08_ssm-document-version-rev-v3"></a>

以前の AWS Systems Manager ドキュメントバージョンに戻す方法について説明します。SSM ドキュメントの詳細については、「AWS Systems Manager ユーザーガイド**」の「[AWS Systems Manager ドキュメント](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html)」を参照してください。

 AWS ParallelCluster コマンドラインインターフェイス (CLI) または API を使用する場合、 AWS ParallelCluster イメージとクラスターを作成または更新するときに作成された AWS リソースに対してのみ料金が発生します。詳細については、「[AWS が使用する サービス AWS ParallelCluster](aws-services-v3.md)」を参照してください。

**前提条件:**
+ SSM ドキュメントを管理するアクセス許可 AWS アカウント を持つ 。
+  AWS CLI [がインストールされ、設定されています。](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)

## SSM ドキュメントを以前のバージョンに戻す
<a name="tutorials_08_ssm-document-version-rev-steps"></a>

1. ターミナルで次のコマンドを実行して、所有している既存の SSM ドキュメントの一覧を取得します。

   ```
   $ aws ssm list-documents --document-filter "key=Owner,value=Self"
   ```

1. SSM ドキュメントを以前のバージョンに戻します。この例では、`SessionManagerRunShell` ドキュメントを以前のバージョンに戻します。SSM `SessionManagerRunShell` ドキュメントを使用して、開始するすべての SSM シェルセッションをカスタマイズできます。

   1. 次のコマンドを実行して、`SessionManagerRunShell` の `DocumentVersion` パラメータを検索します。

      ```
      $ 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` です。

   1. 次のコマンドを実行して、以前のバージョンに戻します。

      ```
      $ aws ssm delete-document --name "SSM-SessionManagerRunShell" --document-version 2
      ```

1. `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` です。