文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭配使用 GetTemplate
與 CLI
下列程式碼範例示範如何使用 GetTemplate
。
- AWS CLI
-
檢視 an AWS CloudFormation 堆疊的範本內文
下列
get-template
命令顯示myteststack
堆疊的範本:aws cloudformation get-template --stack-name
myteststack
輸出:
{ "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" } } } } }
-
如需 API 詳細資訊,請參閱《 AWS CLI 命令參考》中的 GetTemplate
。
-