Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 AWS
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
AWS SDK または CLI DescribeStacks
で を使用する
以下のコード例は、DescribeStacks
の使用方法を示しています。
- CLI
-
- AWS CLI
-
AWS CloudFormation スタックを記述するには
以下の
describe-stacks
例は、myteststack
スタックの概要情報を表示します。aws cloudformation describe-stacks --stack-name
myteststack
出力:
{ "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 } ] }
詳細については、「AWS CloudFormation ユーザーガイド」の「スタック」を参照してください。
-
API の詳細については、「AWS CLI コマンドリファレンス」の「DescribeStacks
」を参照してください。
-
- Go
-
- SDK for Go V2
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 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 }
-
API の詳細については、「AWS SDK for Go API リファレンス」の「DescribeStacks
」を参照してください。
-
- PowerShell
-
- Tools for PowerShell
-
例 1: ユーザーのスタックのすべてを記述するスタックインスタンスのコレクションを返します。
Get-CFNStack
例 2: 指定されたスタックを記述するスタックインスタンスを返します。
Get-CFNStack -StackName "myStack"
-
API の詳細については、「AWS Tools for PowerShell コマンドレットリファレンス」の「DescribeStacks」を参照してください。
-
DescribeStackResources
EstimateTemplateCost