From b051e15fa09b8e6f764a17d7fc35ae6e74e630e1 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sat, 9 May 2020 05:03:38 -0400 Subject: [PATCH] Intial redis template --- top.yaml | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 top.yaml diff --git a/top.yaml b/top.yaml new file mode 100644 index 0000000..541c934 --- /dev/null +++ b/top.yaml @@ -0,0 +1,100 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: General use Redis Cluster +Parameters: + VpcId: + Type: AWS::EC2::VPC::Id + Description: The id of the VPC the cluster will be in + ConstraintDescription: VPC Id must begin with 'vpc-' + SubnetIds: + Type: List + Description: Comma seperated list of subnets for ECS instances to run in + Project: + Type: String + Description: Project used in naming in tagging to associate with cluster + Environment: + Type: String + Description: Environment used in naming and tagging to associate with cluster + NodeType: + Type: String + Default: cache.t3.micro + RedisVersion: + Type: String + Default: 5.0.6 + RedisPort: + Type: Number + Default: 6379 + NumOfNodes: + Type: Number + Default: 2 + ReadNodesPerNode: + Type: Number + Default: 1 + +Resources: + + CacheSecurityGroup: + Type: AWS::EC2::SecurityGroup + Properties: + GroupDescription: Redis Allowed Ports + VpcId: !Ref VpcId + SecurityGroupIngress: + - IpProtocol: icmp + FromPort: '-1' + ToPort: '-1' + CidrIp: 0.0.0.0/0 + - IpProtocol: tcp + FromPort: !Ref RedisPort + ToPort: !Ref RedisPort + CidrIp: 0.0.0.0/0 + SecurityGroupEgress: + - IpProtocol: icmp + FromPort: '-1' + ToPort: '-1' + CidrIp: 0.0.0.0/0 + - IpProtocol: tcp + FromPort: '0' + ToPort: '65535' + CidrIp: 0.0.0.0/0 + - IpProtocol: udp + FromPort: '0' + ToPort: '65535' + CidrIp: 0.0.0.0/0 + + SubnetGroup: + Type: AWS::ElastiCache::SubnetGroup + Properties: + CacheSubnetGroupName: !Sub "${Project}-Cache-${Environment}" + Description: String + SubnetIds: !Ref SubnetIds + + + RedisCluster: + Type: AWS::ElastiCache::ReplicationGroup + Properties: + CacheParameterGroupName: default.redis5.0.cluster.on + CacheNodeType: !Ref NodeType + CacheSubnetGroupName: !Ref SubnetGroup + Engine: redis + EngineVersion: !Ref RedisVersion + NumNodeGroups: !Ref NumOfNodes + Port: !Ref RedisPort + ReplicasPerNodeGroup: !Ref ReadNodesPerNode + ReplicationGroupDescription: Redis group for scaling + SecurityGroupIds: + - !Ref CacheSecurityGroup + Tags: + - Key: Project + Value: !Ref Project + - Key: Environment + Value: !Ref Environment + +Outputs: + Cluster: + Description: Arn of the Redis Cluster + Value: !Ref RedisCluster + Port: + Description: Port + Value: !GetAtt RedisCluster.ConfigurationEndPoint.Port + Endpoint: + Description: Endpoint + Value: !GetAtt RedisCluster.ConfigurationEndPoint.Address \ No newline at end of file