From 57656721d930e7493dab2e4aed6325b4f44a7822 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Tue, 19 Mar 2024 09:32:33 +0300 Subject: [PATCH] Add Redis Serverless Cache --- aws-custom-cluster/template.yaml | 77 +++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 21 deletions(-) diff --git a/aws-custom-cluster/template.yaml b/aws-custom-cluster/template.yaml index bf975b0e..031b4ae9 100644 --- a/aws-custom-cluster/template.yaml +++ b/aws-custom-cluster/template.yaml @@ -211,26 +211,6 @@ Resources: RouteTableId: !Ref RouteTable SubnetId: !Ref EdgeZone - OriginGroup: - Type: 'AWS::AutoScaling::AutoScalingGroup' - DependsOn: - - LaunchTemplateOrigin - Properties: - VPCZoneIdentifier: - - !Ref OriginZone - LaunchTemplate: - LaunchTemplateName: !Sub ${AWS::StackName}-AntMedia-LaunchTemplateOrigin - Version: !GetAtt 'LaunchTemplateOrigin.LatestVersionNumber' - MinSize: 0 - MaxSize: 1 - DesiredCapacity: 0 - TargetGroupARNs: - - !Ref ALBTargetGroupOrigin - Tags: - - Key: Name - Value: Ant-Media-Server - PropagateAtLaunch: 'true' - ELBSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: @@ -324,6 +304,44 @@ Resources: ListenerArn: !Ref ALBListener443 Priority: 1 + RedisServerlessCache: + Type: AWS::ElastiCache::ServerlessCache + DependsOn: + - OriginGroup + Properties: + DailySnapshotTime: "03:00" + Description: "Ant Media Server - Redis Serverless Cache" + Engine: "Redis" + SecurityGroupIds: + - !GetAtt "InstanceSecurityGroup.GroupId" + ServerlessCacheName: !Sub ${AWS::StackName}-ServerlessRedis + SubnetIds: + - !Ref OriginZone + - !Ref EdgeZone + Tags: + - Key: Name + Value: RedisCache + + OriginGroup: + Type: 'AWS::AutoScaling::AutoScalingGroup' + DependsOn: + - LaunchTemplateOrigin + Properties: + VPCZoneIdentifier: + - !Ref OriginZone + LaunchTemplate: + LaunchTemplateName: !Sub ${AWS::StackName}-AntMedia-LaunchTemplateOrigin + Version: !GetAtt 'LaunchTemplateOrigin.LatestVersionNumber' + MinSize: 0 + MaxSize: 1 + DesiredCapacity: 0 + TargetGroupARNs: + - !Ref ALBTargetGroupOrigin + Tags: + - Key: Name + Value: Ant-Media-Server + PropagateAtLaunch: 'true' + LaunchTemplateOrigin: Type: 'AWS::EC2::LaunchTemplate' Properties: @@ -343,7 +361,24 @@ Resources: UserData: Fn::Base64: !Sub | #!/bin/bash - apt-get update + sudo apt-get update -y + sudo apt-get install stunnel -y + sudo tee /etc/stunnel/stunnel.conf > /dev/null <