2016-07-28 8 views
0

私はcloudisテンプレートを使用してredisクラスタを設計していますが、テンプレートの検証中にこのエラーに直面しています。 "テンプレートにエラーがあります:テンプレートフォーマットエラー:JSONがうまく構成されていません(行151、列2以下)エラー!!! CloudFormationテンプレートの検証

は、任意のJSONパーサーは問題が何であるかを教えてくれます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は正しく検証されるためにもう1つの '}'が必要です。スクリプトが妥当性検証をパスしたかどうかは確認していませんが、JSON解析をパスします。

+0

ありがとうございました。この問題を修正した後、検証に「テンプレートにエラーがあります:テンプレートリソースプロパティ 'RedisClusterParameterGroup'が無効です」と表示されます。私はなぜこのリソースを受け入れていないのか分かりません。 – Momooo

+0

** RedisClusterReplicationGroup **内のRefとして** RedisClusterParameterGroup **を使用しています。 paranthesisはレプリケーショングループで閉じられていないため、パラメータグループは決して別のエンティティではありませんでした。レプリケーショングループに対してparanthesisが正しく閉じられると、パラメータグループは別のリソースになりました。私はRefが今それを拾うことを期待しています。私はそれに応じてjsonを編集しました。それが動作するかどうか私に教えてください。 – naren

+0

はい、ナン。それは本当に括弧付きのテンプレートをデバッグするのは本当に苦しい仕事のように見えました。 – Momooo

0

JSONエラーのこの一連の問題を避ける方法の1つは、CloudFormでサポートされているYAML構文に切り替えることです。 JSONドキュメントをYAMLに変換して https://www.json2yaml.com/ にして、それをそのまま使用することができます。私は、YAMLが引用符、中括弧、およびカンマなしで維持する方がはるかに簡単だと思っています。

関連する問題