2016-07-28 3 views
0

cloudization 템플릿을 사용하여 템플릿을 검증하고 템플릿 유효성 확인 중에이 오류가 발생합니다. "템플릿에 오류가 있습니다. 템플릿 형식 오류 : JSON 형식이 올바르지 않습니다 (151 행 2 열) "오류 !!! CloudFormation 템플릿 유효성 검사

다음은

{ 
    "AWSTemplateFormatVersion": "2010-09-09", 
    "Metadata": { 
    "AWS::CloudFormation::Designer": { 
     "f60e2d2e-b46b-48b1-88c8-eecce45d2166": { 
     "size": { 
      "width": 60, 
      "height": 60 
     }, 
     "position": { 
      "x": 320, 
      "y": 70 
     }, 
     "z": 2, 
     "parent": "71508a33-8207-4580-8721-c3688c4a0353", 
     "embeds": [], 
     "ismemberof": [ 
      "a63aacbd-1c6e-4118-8bbe-08a5bc63052a", 
      "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad" 
     ] 
     }, 
     "a63aacbd-1c6e-4118-8bbe-08a5bc63052a": { 
     "size": { 
      "width": 60, 
      "height": 60 
     }, 
     "position": { 
      "x": 320, 
      "y": 160 
     }, 
     "z": 2, 
     "parent": "71508a33-8207-4580-8721-c3688c4a0353", 
     "embeds": [] 
     }, 
     "0291abc8-9c50-491b-8400-e1f7f8b22118": { 
     "source": { 
      "id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166" 
     }, 
     "target": { 
      "id": "a63aacbd-1c6e-4118-8bbe-08a5bc63052a" 
     }, 
     "z": 1 
     }, 
     "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad": { 
     "size": { 
      "width": 60, 
      "height": 60 
     }, 
     "position": { 
      "x": 440, 
      "y": 70 
     }, 
     "z": 2, 
     "parent": "71508a33-8207-4580-8721-c3688c4a0353", 
     "embeds": [] 
     }, 
     "7aa270dd-1131-4dc4-8913-dfaf44a3815d": { 
     "source": { 
      "id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166" 
     }, 
     "target": { 
      "id": "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad" 
     }, 
     "z": 2 
     }, 
     "71508a33-8207-4580-8721-c3688c4a0353": { 
     "size": { 
      "width": 610, 
      "height": 600 
     }, 
     "position": { 
      "x": 20, 
      "y": 10 
     }, 
     "z": 1, 
     "embeds": [ 
      "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad", 
      "a63aacbd-1c6e-4118-8bbe-08a5bc63052a", 
      "f60e2d2e-b46b-48b1-88c8-eecce45d2166" 
     ] 
     } 
    } 
    }, 
    "Parameters" : { 
    "CacheNodeType" : { 
    "Description" : "The compute and memory capacity of the nodes in the Cache Cluster", 
    "Type" : "String", 
    "Default" : "cache.m3.medium", 
    "AllowedValues" : ["cache.t2.micro", "cache.t2.small", "cache.t2.medium", 
     "cache.m3.medium", "cache.m3.large", "cache.m3.xlarge", "cache.m3.2xlarge", 
     "cache.t1.micro", "cache.m1.small", "cache.m1.medium", "cache.m1.large", 
     "cache.m1.xlarge", "cache.c1.xlarge", "cache.r3.large", "cache.r3.xlarge", 
     "cache.r3.2xlarge", "cache.r3.4xlarge","cache.r3.8xlarge", "cache.m2.xlarge", 
     "cache.m2.2xlarge", "cache.m2.4xlarge"], 
     "ConstraintDescription" : "must select a valid Cache Node type." 
    } 
    }, 

    "Resources": { 
    "RedisClusterReplicationGroup": { 
     "Type": "AWS::ElastiCache::ReplicationGroup", 
     "Properties": { 
     "CacheParameterGroupName": { 
     "Ref": "RedisClusterParameterGroup" 
     }, 
     "CacheSubnetGroupName": { 
     "Ref": "RedisClusterSubnetGroup" 
     }, 
     "CacheNodeType" : { "Ref" : "CacheNodeType" }, 
     "Engine" : "redis", 
     "EngineVersion" : "2.8.24", 
     "NumCacheClusters" : 4, 
     "Port" : 6879, 
     "PreferredCacheClusterAZs" : ["us-east-1c","us-east-1d","us-east-1e"], 
     "ReplicationGroupDescription" : "RedisClusterReplicationGroup", 
     "SecurityGroupIds" : "sg-7ea72e07", 
     "SnapshotRetentionLimit" : 0, 
     "AutomaticFailoverEnabled" : true, 
     "Metadata": { 
     "AWS::CloudFormation::Designer": { 
      "id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166" 
     } 
     } 
    }, 
    "RedisClusterParameterGroup": { 
     "Type": "AWS::ElastiCache::ParameterGroup", 
     "Properties": { 
     "CacheParameterGroupFamily" : "redis2.8", 
     "CacheParameterGroupName" : "RedisClusterParameterGroup", 
     "Description" :"RedisClusterParameterGroup" 
     }, 
     "Metadata": { 
     "AWS::CloudFormation::Designer": { 
      "id": "a63aacbd-1c6e-4118-8bbe-08a5bc63052a" 
     } 
     } 
    }, 
    "RedisClusterSubnetGroup": { 
     "Type": "AWS::ElastiCache::SubnetGroup", 
     "Properties": { 
     "Description" : "RedisClusterSubnetGroups", 
     "SubnetIds" : ["subnet-7854ab20", "subnet-eaa7039c", "subnet-988a00a5"] 
     }, 
     "Metadata": { 
     "AWS::CloudFormation::Designer": { 
      "id": "71508a33-8207-4580-8721-c3688c4a0353" 
     } 
     } 
    } 
    }, 
} 
+0

파일 끝 부분에 방금 없습니다. – Shantanu

답변

0
{ 
    "AWSTemplateFormatVersion": "2010-09-09", 
    "Metadata": { 
    "AWS::CloudFormation::Designer": { 
     "f60e2d2e-b46b-48b1-88c8-eecce45d2166": { 
     "size": { 
      "width": 60, 
      "height": 60 
     }, 
     "position": { 
      "x": 320, 
      "y": 70 
     }, 
     "z": 2, 
     "parent": "71508a33-8207-4580-8721-c3688c4a0353", 
     "embeds": [], 
     "ismemberof": [ 
      "a63aacbd-1c6e-4118-8bbe-08a5bc63052a", 
      "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad" 
     ] 
     }, 
     "a63aacbd-1c6e-4118-8bbe-08a5bc63052a": { 
     "size": { 
      "width": 60, 
      "height": 60 
     }, 
     "position": { 
      "x": 320, 
      "y": 160 
     }, 
     "z": 2, 
     "parent": "71508a33-8207-4580-8721-c3688c4a0353", 
     "embeds": [] 
     }, 
     "0291abc8-9c50-491b-8400-e1f7f8b22118": { 
     "source": { 
      "id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166" 
     }, 
     "target": { 
      "id": "a63aacbd-1c6e-4118-8bbe-08a5bc63052a" 
     }, 
     "z": 1 
     }, 
     "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad": { 
     "size": { 
      "width": 60, 
      "height": 60 
     }, 
     "position": { 
      "x": 440, 
      "y": 70 
     }, 
     "z": 2, 
     "parent": "71508a33-8207-4580-8721-c3688c4a0353", 
     "embeds": [] 
     }, 
     "7aa270dd-1131-4dc4-8913-dfaf44a3815d": { 
     "source": { 
      "id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166" 
     }, 
     "target": { 
      "id": "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad" 
     }, 
     "z": 2 
     }, 
     "71508a33-8207-4580-8721-c3688c4a0353": { 
     "size": { 
      "width": 610, 
      "height": 600 
     }, 
     "position": { 
      "x": 20, 
      "y": 10 
     }, 
     "z": 1, 
     "embeds": [ 
      "55eb37aa-e764-49ac-b8fe-3eddb2ea77ad", 
      "a63aacbd-1c6e-4118-8bbe-08a5bc63052a", 
      "f60e2d2e-b46b-48b1-88c8-eecce45d2166" 
     ] 
     } 
    } 
    }, 
    "Parameters": { 
    "CacheNodeType": { 
     "Description": "The compute and memory capacity of the nodes in the Cache Cluster", 
     "Type": "String", 
     "Default": "cache.m3.medium", 
     "AllowedValues": [ 
     "cache.t2.micro", 
     "cache.t2.small", 
     "cache.t2.medium", 
     "cache.m3.medium", 
     "cache.m3.large", 
     "cache.m3.xlarge", 
     "cache.m3.2xlarge", 
     "cache.t1.micro", 
     "cache.m1.small", 
     "cache.m1.medium", 
     "cache.m1.large", 
     "cache.m1.xlarge", 
     "cache.c1.xlarge", 
     "cache.r3.large", 
     "cache.r3.xlarge", 
     "cache.r3.2xlarge", 
     "cache.r3.4xlarge", 
     "cache.r3.8xlarge", 
     "cache.m2.xlarge", 
     "cache.m2.2xlarge", 
     "cache.m2.4xlarge" 
     ], 
     "ConstraintDescription": "must select a valid Cache Node type." 
    } 
    }, 
    "Resources": { 
    "RedisClusterReplicationGroup": { 
     "Type": "AWS::ElastiCache::ReplicationGroup", 
     "Properties": { 
     "CacheParameterGroupName": { 
      "Ref": "RedisClusterParameterGroup" 
     }, 
     "CacheSubnetGroupName": { 
      "Ref": "RedisClusterSubnetGroup" 
     }, 
     "CacheNodeType": { 
      "Ref": "CacheNodeType" 
     }, 
     "Engine": "redis", 
     "EngineVersion": "2.8.24", 
     "NumCacheClusters": 4, 
     "Port": 6879, 
     "PreferredCacheClusterAZs": [ 
      "us-east-1c", 
      "us-east-1d", 
      "us-east-1e" 
     ], 
     "ReplicationGroupDescription": "RedisClusterReplicationGroup", 
     "SecurityGroupIds": "sg-7ea72e07", 
     "SnapshotRetentionLimit": 0, 
     "AutomaticFailoverEnabled": true, 
     "Metadata": { 
      "AWS::CloudFormation::Designer": { 
      "id": "f60e2d2e-b46b-48b1-88c8-eecce45d2166" 
      } 
     } 
     } 
    }, 
     "RedisClusterParameterGroup": { 
     "Type": "AWS::ElastiCache::ParameterGroup", 
     "Properties": { 
      "CacheParameterGroupFamily": "redis2.8", 
      "CacheParameterGroupName": "RedisClusterParameterGroup", 
      "Description": "RedisClusterParameterGroup" 
     }, 
     "Metadata": { 
      "AWS::CloudFormation::Designer": { 
      "id": "a63aacbd-1c6e-4118-8bbe-08a5bc63052a" 
      } 
     } 
     }, 
     "RedisClusterSubnetGroup": { 
     "Type": "AWS::ElastiCache::SubnetGroup", 
     "Properties": { 
      "Description": "RedisClusterSubnetGroups", 
      "SubnetIds": [ 
      "subnet-7854ab20", 
      "subnet-eaa7039c", 
      "subnet-988a00a5" 
      ] 
     }, 
     "Metadata": { 
      "AWS::CloudFormation::Designer": { 
      "id": "71508a33-8207-4580-8721-c3688c4a0353" 
      } 
     } 
     } 
    } 
    } 

는 모든 JSON 파서가 문제가 무엇인지를 알려줍니다 cloudformation 스크립트를합니다. 마지막 요소에는 ','이있을 필요가 없으며 JSON은 적절하게 유효성을 검사하기 위해 하나 더 '}'가 필요합니다. 스크립트가 cloudformation 유효성 검사를 통과하는지 확인하지 않았지만 JSON 구문 분석을 전달합니다.

+0

감사합니다. 이 문제를 수정 한 후 유효성 검사에서 "템플릿에 오류가 있습니다. : 잘못된 템플릿 리소스 속성 'RedisClusterParameterGroup'"입니다. 나는이 자원을 받아들이지 않는 이유를 이해하지 못합니다. – Momooo

+0

** RedisClusterReplicationGroup ** 내부의 Ref로 ** RedisClusterParameterGroup **을 사용하고 있습니다. paranthesis가 복제 그룹에 대해 닫히지 않았으므로 매개 변수 그룹이 절대로 별도의 엔터티가 아니 었습니다. 복제 그룹에 대해 paranthesis가 제대로 닫히면 이제 매개 변수 그룹이 별도의 리소스가됩니다. 나는 Ref를 기대하고 있습니다. 그에 따라 json을 편집했습니다. 작동하는지 알려주세요. – naren

+0

예, 나렌. 특히 괄호로 템플릿을 디버깅하는 것은 정말 힘든 일처럼 보입니다. – Momooo

0

이 JSON 오류 집합을 피하는 한 가지 방법은 Cloudformation에서 지원하는 YAML 구문으로 전환하는 것입니다. JSON 문서를 https://www.json2yaml.com/ 에서 YAML로 변환 한 다음 사용하면됩니다. 따옴표, 중괄호, 쉼표없이 YAML을 유지하는 것이 훨씬 쉽습니다.