

Sono disponibili altri esempi AWS SDK nel repository [AWS Doc SDK](https://github.com/awsdocs/aws-doc-sdk-examples) Examples. GitHub 

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Utilizzare `GetTemplate` con una CLI
<a name="cloudformation_example_cloudformation_GetTemplate_section"></a>

Gli esempi di codice seguenti mostrano come utilizzare `GetTemplate`.

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

**AWS CLI**  
**Per visualizzare il corpo del modello per uno stack AWS CloudFormation **  
Il comando `get-template` seguente mostra il modello per lo stack `myteststack`:  

```
aws cloudformation get-template --stack-name myteststack
```
Output:  

```
{
    "TemplateBody": {
        "AWSTemplateFormatVersion": "2010-09-09",
        "Outputs": {
            "BucketName": {
                "Description": "Name of S3 bucket to hold website content",
                "Value": {
                    "Ref": "S3Bucket"
                }
            }
        },
        "Description": "AWS CloudFormation Sample Template S3_Bucket: Sample template showing how to create a publicly accessible S3 bucket. **WARNING** This template creates an S3 bucket. You will be billed for the AWS resources used if you create a stack from this template.",
        "Resources": {
            "S3Bucket": {
                "Type": "AWS::S3::Bucket",
                "Properties": {
                    "AccessControl": "PublicRead"
                }
            }
        }
    }
}
```
+  Per i dettagli sull'API, consulta [GetTemplate AWS CLI](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/get-template.html)*Command Reference.* 

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

**Strumenti per PowerShell V4**  
**Esempio 1: restituisce il modello associato allo stack specificato.**  

```
Get-CFNTemplate -StackName "myStack"
```
+  Per i dettagli sull'API, vedere [GetTemplate](https://docs.aws.amazon.com/powershell/v4/reference)in *AWS Strumenti per PowerShell Cmdlet Reference (*V4). 

**Strumenti per V5 PowerShell **  
**Esempio 1: restituisce il modello associato allo stack specificato.**  

```
Get-CFNTemplate -StackName "myStack"
```
+  Per i dettagli sull'API, vedere [GetTemplate](https://docs.aws.amazon.com/powershell/v5/reference)in *AWS Strumenti per PowerShell Cmdlet Reference (*V5). 

------