

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à.

# Utilizzo `DescribeStacks` con un AWS SDK o una CLI
<a name="cloudformation_example_cloudformation_DescribeStacks_section"></a>

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

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

**AWS CLI**  
**Per descrivere gli stack AWS CloudFormation **  
Il comando `describe-stacks` seguente mostra le informazioni di riepilogo per lo stack `myteststack`:  

```
aws cloudformation describe-stacks --stack-name myteststack
```
Output:  

```
{
    "Stacks":  [
        {
            "StackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/myteststack/466df9e0-0dff-08e3-8e2f-5088487c4896",
            "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.",
            "Tags": [],
            "Outputs": [
                {
                    "Description": "Name of S3 bucket to hold website content",
                    "OutputKey": "BucketName",
                    "OutputValue": "myteststack-s3bucket-jssofi1zie2w"
                }
            ],
            "StackStatusReason": null,
            "CreationTime": "2013-08-23T01:02:15.422Z",
            "Capabilities": [],
            "StackName": "myteststack",
            "StackStatus": "CREATE_COMPLETE",
            "DisableRollback": false
        }
    ]
}
```
Per ulteriori informazioni, consulta Stacks nella Guida per l'*AWS CloudFormation utente*.  
+  Per i dettagli sull'API, consulta [DescribeStacks AWS CLI](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/describe-stacks.html)*Command Reference.* 

------
#### [ Go ]

**SDK per Go V2**  
 C'è altro su GitHub. Trova l'esempio completo e scopri di più sulla configurazione e l'esecuzione nel [Repository di esempi di codice AWS](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2/workflows/user_pools_and_lambda_triggers#code-examples). 

```
import (
	"context"
	"log"

	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/aws-sdk-go-v2/service/cloudformation"
)

// StackOutputs defines a map of outputs from a specific stack.
type StackOutputs map[string]string

type CloudFormationActions struct {
	CfnClient *cloudformation.Client
}

// GetOutputs gets the outputs from a CloudFormation stack and puts them into a structured format.
func (actor CloudFormationActions) GetOutputs(ctx context.Context, stackName string) StackOutputs {
	output, err := actor.CfnClient.DescribeStacks(ctx, &cloudformation.DescribeStacksInput{
		StackName: aws.String(stackName),
	})
	if err != nil || len(output.Stacks) == 0 {
		log.Panicf("Couldn't find a CloudFormation stack named %v. Here's why: %v\n", stackName, err)
	}
	stackOutputs := StackOutputs{}
	for _, out := range output.Stacks[0].Outputs {
		stackOutputs[*out.OutputKey] = *out.OutputValue
	}
	return stackOutputs
}
```
+  Per i dettagli sull'API, [DescribeStacks](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/cloudformation#Client.DescribeStacks)consulta *AWS SDK per Go API Reference*. 

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

**Strumenti per PowerShell V4**  
**Esempio 1: restituisce una raccolta di istanze di stack che descrivono tutti gli stack dell’utente.**  

```
Get-CFNStack
```
**Esempio 2: restituisce un’istanza di stack che descrive lo stack specificato**  

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

**Strumenti per V5 PowerShell **  
**Esempio 1: restituisce una raccolta di istanze di stack che descrivono tutti gli stack dell’utente.**  

```
Get-CFNStack
```
**Esempio 2: restituisce un’istanza di stack che descrive lo stack specificato**  

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

------