Invalid template property or properties [ElasticacheCluster]

Viewed 111

I'm getting the error mentioned in the title and I'm out of ideas on how to fix it. The Error is in the ElasticacheCluster part. I tried to modify it in a lot of ways, that's why there's some commented line of code but I did not remove maybe they might help in the troubleshooting. This is my code below:

    #### Creating Elasticache ####

  ElasticacheSecurityGroup:
    Type: 'AWS::EC2::SecurityGroup'
    Properties:
      GroupDescription: Elasticache Security Group
      VpcId: !Ref PubPrivateVPC
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: '11211'
          ToPort: '11211'
          CidrIp: 0.0.0.0/0
      Tags:
        -
          Key: "Name"
          Value: !Join [_, [!Ref 'AWS::StackName',ElasiCache-SG]]
#          SourceSecurityGroupName: !Ref InstanceSecurityGroup

  CacheSubnetGroup:
    Type: 'AWS::ElastiCache::SubnetGroup'
    Properties:
      Description: cache
      SubnetIds:
        - !Ref PrivateSubnet1
        - !Ref PrivateSubnet2
        - !Ref PrivateSubnet3

ElasticacheCluster:
  Type: AWS::ElastiCache::CacheCluster
  Properties:    
    Engine: memcached
    EngineVersion: 1.6.6
    CacheNodeType: cache.t2.micro
    CacheSubnetGroupName: !Ref CacheSubnetGroup
    NumCacheNodes: '1'
#    VpcId: !Ref PubPrivateVPC
    VpcSecurityGroupIds: !Ref ElasticacheSecurityGroup
#      - !GetAtt 
#        - ElasticacheSecurityGroup
#        - GroupId
1 Answers

Your cluster resource is not indented.

This should be working:

  ElasticacheSecurityGroup:
    Type: 'AWS::EC2::SecurityGroup'
    Properties:
      GroupDescription: Elasticache Security Group
      VpcId: !Ref PubPrivateVPC
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: '11211'
          ToPort: '11211'
          CidrIp: 0.0.0.0/0
      Tags:
        -
          Key: "Name"
          Value: !Join [_, [!Ref 'AWS::StackName',ElasiCache-SG]]
#          SourceSecurityGroupName: !Ref InstanceSecurityGroup

  CacheSubnetGroup:
    Type: 'AWS::ElastiCache::SubnetGroup'
    Properties:
      Description: cache
      SubnetIds:
        - !Ref PrivateSubnet1
        - !Ref PrivateSubnet2
        - !Ref PrivateSubnet3

  ElasticacheCluster:
    Type: AWS::ElastiCache::CacheCluster
    Properties:    
      Engine: memcached
      EngineVersion: 1.6.6
      CacheNodeType: cache.t2.micro
      CacheSubnetGroupName: !Ref CacheSubnetGroup
      NumCacheNodes: '1'
  #    VpcId: !Ref PubPrivateVPC
      VpcSecurityGroupIds: 
        - !Ref ElasticacheSecurityGroup
  #      - !GetAtt 
  #        - ElasticacheSecurityGroup
  #        - GroupId
Related