检索模板 - Amazon CloudFormation
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

检索模板

Amazon CloudFormation 可将用于创建堆栈的模板存储为堆栈的一部分。要从 CloudFormation 中检索模板,请使用 aws cloudformation get-template 命令。

注意

aws cloudformation get-template 命令可在堆栈已删除后的 90 天内返回已删除堆栈模板的相关信息。

以下示例显示 myteststack 堆栈的模板。

PROMPT> 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": "Amazon 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 Amazon resources used if you create a stack from this template.", "Resources": { "S3Bucket": { "Type": "AWS::S3::Bucket", "Properties": { "AccessControl": "PublicRead" } } } } }

输出将包含整个模板正文,并括在引号中。