CLI로 GetTemplate 사용 - AWS SDK 코드 예제

AWS SDK 예제 GitHub 리포지토리에 더 많은 AWS문서 SDK 예제가 있습니다.

CLI로 GetTemplate 사용

다음 코드 예시는 GetTemplate의 사용 방법을 보여 줍니다.

CLI
AWS CLI

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을 참조하세요.

PowerShell
Tools for PowerShell V4

예 1: 지정된 스택과 연결된 템플릿을 반환합니다.

Get-CFNTemplate -StackName "myStack"
  • API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V4)GetTemplate을 참조하세요.

Tools for PowerShell V5

예 1: 지정된 스택과 연결된 템플릿을 반환합니다.

Get-CFNTemplate -StackName "myStack"
  • API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V5)GetTemplate을 참조하세요.