

• El panel de AWS Systems Manager CloudWatch dejará de estar disponible después del 30 de abril de 2026. Los clientes pueden seguir utilizando la consola de Amazon CloudWatch para ver, crear y administrar sus paneles de Amazon CloudWatch, tal y como lo hacen actualmente. Para obtener más información, consulte la [documentación del panel de Amazon CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html). 

# Utilizar `GetDocument` con una CLI
<a name="example_ssm_GetDocument_section"></a>

Los siguientes ejemplos de código muestran cómo utilizar `GetDocument`.

------
#### [ CLI ]

**AWS CLI**  
**Obtención del contenido de un documento**  
En el siguiente ejemplo de `get-document` se muestra el contenido de un documento de Systems Manager.  

```
aws ssm get-document \
    --name "AWS-RunShellScript"
```
Salida:  

```
{
    "Name": "AWS-RunShellScript",
    "DocumentVersion": "1",
    "Status": "Active",
    "Content": "{\n    \"schemaVersion\":\"1.2\",\n    \"description\":\"Run a shell script or specify the commands to run.\",\n    \"parameters\":{\n        \"commands\":{\n            \"type\":\"StringList\",\n            \"description\":\"(Required) Specify a shell script or a command to run.\",\n            \"minItems\":1,\n            \"displayType\":\"textarea\"\n        },\n        \"workingDirectory\":{\n            \"type\":\"String\",\n            \"default\":\"\",\n            \"description\":\"(Optional) The path to the working directory on your instance.\",\n            \"maxChars\":4096\n        },\n        \"executionTimeout\":{\n            \"type\":\"String\",\n            \"default\":\"3600\",\n            \"description\":\"(Optional) The time in seconds for a command to complete before it is considered to have failed. Default is 3600 (1 hour). Maximum is 172800 (48 hours).\",\n            \"allowedPattern\":\"([1-9][0-9]{0,4})|(1[0-6][0-9]{4})|(17[0-1][0-9]{3})|(172[0-7][0-9]{2})|(172800)\"\n        }\n    },\n    \"runtimeConfig\":{\n        \"aws:runShellScript\":{\n            \"properties\":[\n                {\n                    \"id\":\"0.aws:runShellScript\",\n                    \"runCommand\":\"{{ commands }}\",\n                    \"workingDirectory\":\"{{ workingDirectory }}\",\n                    \"timeoutSeconds\":\"{{ executionTimeout }}\"\n                }\n            ]\n        }\n    }\n}\n",
    "DocumentType": "Command",
    "DocumentFormat": "JSON"
}
```
Para obtener más información, consulte [Documentos de AWS Systems Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html) en la *Guía del usuario de AWS Systems Manager*.  
+  Para obtener información sobre la API, consulte [GetDocument](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/get-document.html) en la *Referencia de comandos de la AWS CLI*. 

------
#### [ PowerShell ]

**Herramientas para PowerShell V4**  
**Ejemplo 1: en este ejemplo se devuelve el contenido de un documento.**  

```
Get-SSMDocument -Name "RunShellScript"
```
**Salida:**  

```
Content
-------
{...
```
**Ejemplo 2: en este ejemplo se muestra el contenido completo de un documento.**  

```
(Get-SSMDocument -Name "RunShellScript").Content
{
   "schemaVersion":"2.0",
   "description":"Run an updated script",
   "parameters":{
      "commands":{
         "type":"StringList",
         "description":"(Required) Specify a shell script or a command to run.",
         "minItems":1,
         "displayType":"textarea"
      }
   },
   "mainSteps":[
      {
         "action":"aws:runShellScript",
         "name":"runShellScript",
         "inputs":{
            "commands":"{{ commands }}"
         }
      },
      {
         "action":"aws:runPowerShellScript",
         "name":"runPowerShellScript",
         "inputs":{
            "commands":"{{ commands }}"
         }
      }
   ]
}
```
+  Para obtener información sobre la API, consulte [GetDocument](https://docs.aws.amazon.com/powershell/v4/reference) en la *Referencia de Cmdlet de las Herramientas de AWS para PowerShell (V4)*. 

**Herramientas para PowerShell V5**  
**Ejemplo 1: en este ejemplo se devuelve el contenido de un documento.**  

```
Get-SSMDocument -Name "RunShellScript"
```
**Salida:**  

```
Content
-------
{...
```
**Ejemplo 2: en este ejemplo se muestra el contenido completo de un documento.**  

```
(Get-SSMDocument -Name "RunShellScript").Content
{
   "schemaVersion":"2.0",
   "description":"Run an updated script",
   "parameters":{
      "commands":{
         "type":"StringList",
         "description":"(Required) Specify a shell script or a command to run.",
         "minItems":1,
         "displayType":"textarea"
      }
   },
   "mainSteps":[
      {
         "action":"aws:runShellScript",
         "name":"runShellScript",
         "inputs":{
            "commands":"{{ commands }}"
         }
      },
      {
         "action":"aws:runPowerShellScript",
         "name":"runPowerShellScript",
         "inputs":{
            "commands":"{{ commands }}"
         }
      }
   ]
}
```
+  Para obtener información sobre la API, consulte [GetDocument](https://docs.aws.amazon.com/powershell/v5/reference) en la *Referencia de Cmdlet de las Herramientas de AWS para PowerShell (V5)*. 

------

Para obtener una lista completa de las guías para desarrolladores de AWS SDK y ejemplos de código, consulte [Cómo utilizar este servicio con un AWS SDK](sdk-general-information-section.md). En este tema también se incluye información sobre cómo comenzar a utilizar el SDK y detalles sobre sus versiones anteriores.