AWS 文档 SDK 示例
将 GetTemplate 与 CLI 配合使用
以下代码示例演示如何使用 GetTemplate。
- CLI
-
- AWS CLI
-
查看 AWS CloudFormation 堆栈的模板正文
以下
get-template命令显示myteststack堆栈的模板:aws cloudformation get-template --stack-namemyteststack输出:
{ "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
。
-
- PowerShell
-
- Tools for PowerShell V4
-
示例 1:返回与指定堆栈关联的模板。
Get-CFNTemplate -StackName "myStack"-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference(V4)》中的 GetTemplate。
-
- Tools for PowerShell V5
-
示例 1:返回与指定堆栈关联的模板。
Get-CFNTemplate -StackName "myStack"-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference(V5)》中的 GetTemplate。
-
EstimateTemplateCost
ListStackResources