템플릿 형식 - AWS CloudFormation

템플릿 형식

JSON 또는 YAML 형식으로 CloudFormation 템플릿을 작성할 수 있습니다. 두 형식 모두에서 동일한 CloudFormation 기능 및 함수를 사용할 수 있습니다.

JSON

다음 예제에서는 사용 가능한 모든 섹션이 있는 JSON 형식의 템플릿 구조를 보여줍니다.

{ "AWSTemplateFormatVersion" : "version date", "Description" : "JSON string", "Metadata" : { template metadata }, "Parameters" : { set of parameters }, "Rules" : { set of rules }, "Mappings" : { set of mappings }, "Conditions" : { set of conditions }, "Transform" : { set of transforms }, "Resources" : { set of resources }, "Outputs" : { set of outputs } }

YAML

다음 예제에서는 사용 가능한 모든 섹션이 있는 YAML 형식의 템플릿 구조를 보여줍니다.

--- AWSTemplateFormatVersion: "version date" Description: String Metadata: template metadata Parameters: set of parameters Rules: set of rules Mappings: set of mappings Conditions: set of conditions Transform: set of transforms Resources: set of resources Outputs: set of outputs

사용할 형식을 결정할 때 가장 편안하게 작업할 수 있는 형식을 선택하십시오. 또한 YAML은 JSON으로 사용할 수 없는 설명 작성과 같은 몇 가지 기능을 본질적으로 제공합니다.

다음 예제에서는 인라인 설명이 있는 YAML 템플릿을 보여 줍니다.

AWSTemplateFormatVersion: "2010-09-09" Description: A sample template Resources: MyEC2Instance: #An inline comment Type: "AWS::EC2::Instance" Properties: ImageId: "ami-0ff8a91507f77f867" #Another comment -- This is a Linux AMI InstanceType: t2.micro KeyName: testkey BlockDeviceMappings: - DeviceName: /dev/sdm Ebs: VolumeType: io1 Iops: 200 DeleteOnTermination: false VolumeSize: 20

사양

CloudFormation은 다음과 같은 JSON 및 YAML 사양을 지원합니다.

JSON

CloudFormation은 ECMA-404 JSON 표준을 따릅니다. JSON 형식에 대한 자세한 내용은 http://www.json.org를 참조하십시오.

YAML

CloudFormation은 몇 가지 예외가 있지만 YAML 버전 1.1 사양을 지원합니다. CloudFormation은 다음과 같은 기능을 지원하지 않습니다.

  • binary, omap, pairs, settimestamp 태그

  • 에일리어스

  • 해시 병합

YAML에 대한 자세한 내용은 http://yaml.org/를 참조하세요.

자세히 알아보기

템플릿에서 지정하는 각 리소스에 대해 JSON 또는 YAML의 특정 구문 규칙을 사용하여 해당 속성과 값을 정의합니다. 각 형식의 템플릿 구문에 대한 자세한 내용은 템플릿 섹션 단원을 참조하십시오.