

Weitere AWS SDK-Beispiele sind im GitHub Repo [AWS Doc SDK Examples](https://github.com/awsdocs/aws-doc-sdk-examples) verfügbar.

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# Verwendung `DescribeStacks` mit einem AWS SDK oder CLI
<a name="cloudformation_example_cloudformation_DescribeStacks_section"></a>

Die folgenden Code-Beispiele zeigen, wie `DescribeStacks` verwendet wird.

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

**AWS CLI**  
**Um AWS CloudFormation Stapel zu beschreiben**  
Der folgende `describe-stacks`-Befehl zeigt eine Zusammenfassung der Informationen für den `myteststack`-Stack:  

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

```
{
    "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
        }
    ]
}
```
Weitere Informationen finden Sie unter Stacks im *AWS CloudFormation Benutzerhandbuch*.  
+  Einzelheiten zur API finden Sie [DescribeStacks](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/describe-stacks.html)in der *AWS CLI Befehlsreferenz.* 

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

**SDK für Go V2**  
 Es gibt noch mehr dazu GitHub. Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das [AWS -Code-Beispiel-](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2/workflows/user_pools_and_lambda_triggers#code-examples) einrichten und ausführen. 

```
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
}
```
+  Einzelheiten zur API finden Sie [DescribeStacks](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/cloudformation#Client.DescribeStacks)in der *AWS SDK für Go API-Referenz*. 

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

**Tools für PowerShell V4**  
**Beispiel 1: Gibt eine Sammlung von Stack-Instances zurück, die alle Stacks des Benutzers beschreiben.**  

```
Get-CFNStack
```
**Beispiel 2: Gibt eine Stack-Instance zurück, die den angegebenen Stack beschreibt**  

```
Get-CFNStack -StackName "myStack"
```
+  Einzelheiten zur API finden Sie unter [DescribeStacks AWS -Tools für PowerShell](https://docs.aws.amazon.com/powershell/v4/reference)*Cmdlet-Referenz (V4).* 

**Tools für V5 PowerShell **  
**Beispiel 1: Gibt eine Sammlung von Stack-Instances zurück, die alle Stacks des Benutzers beschreiben.**  

```
Get-CFNStack
```
**Beispiel 2: Gibt eine Stack-Instance zurück, die den angegebenen Stack beschreibt**  

```
Get-CFNStack -StackName "myStack"
```
+  Einzelheiten zur API finden Sie unter [DescribeStacks AWS -Tools für PowerShell](https://docs.aws.amazon.com/powershell/v5/reference)*Cmdlet-Referenz (*V5). 

------