diff --git a/config/infra-dev/nextflow-elasticache-cluster.yaml b/config/infra-dev/nextflow-elasticache-cluster.yaml index cc23266a..a43bf2dd 100644 --- a/config/infra-dev/nextflow-elasticache-cluster.yaml +++ b/config/infra-dev/nextflow-elasticache-cluster.yaml @@ -8,7 +8,10 @@ dependencies: parameters: VpcId: !stack_output_external nextflow-vpc::VPCId - SubnetId: !stack_output_external nextflow-ecs-cluster::EcsAutoScalingGroupSubnetId + VpcSubnetIDs: + - !stack_output_external nextflow-vpc::PrivateSubnet1 + - !stack_output_external nextflow-vpc::PrivateSubnet2 + - !stack_output_external nextflow-vpc::PrivateSubnet3 EcsSecurityGroupId: !stack_output_external nextflow-ecs-security-group::SecurityGroupId stack_tags: diff --git a/templates/nextflow-elasticache-cluster.yaml b/templates/nextflow-elasticache-cluster.yaml index 9d644750..6ecf6f53 100644 --- a/templates/nextflow-elasticache-cluster.yaml +++ b/templates/nextflow-elasticache-cluster.yaml @@ -5,14 +5,14 @@ Parameters: Description: ID of VPC Type: AWS::EC2::VPC::Id + VpcSubnetIDs: + Description: The VPC subnet IDs. + Type: List + EcsSecurityGroupId: Type: AWS::EC2::SecurityGroup::Id Description: Security group ID for ECS cluster to grant database access - SubnetId: - Description: The ID of the ECS subnet group. - Type: String - Resources: ElasticacheSecurityGroup: Type: 'AWS::EC2::SecurityGroup' @@ -24,29 +24,23 @@ Resources: IpProtocol: tcp FromPort: 6379 ToPort: 6379 + ElasticacheSubnetGroup: + Type: AWS::ElastiCache::SubnetGroup + Properties: + Description: Elasticache subnet group + SubnetIds: !Ref VpcSubnetIDs ElasticacheCluster: Type: AWS::ElastiCache::CacheCluster Properties: - CacheNodeType: cache.r6gd.xlarge + CacheNodeType: cache.r6g.large Engine: redis - NumCacheNodes: '1' - TransitEncryptionEnabled: true + NumCacheNodes: "1" VpcSecurityGroupIds: - !GetAtt ElasticacheSecurityGroup.GroupId - CacheSubnetGroupName: !Ref SubnetId + CacheSubnetGroupName: !Ref ElasticacheSubnetGroup Outputs: - ElasticacheClusterEndpointAddress: - Value: !GetAtt ElasticacheCluster.ConfigurationEndpoint.Address - Export: - Name: !Sub '${AWS::Region}-${AWS::StackName}-ElasticacheClusterEndpointAddress' - - ElasticacheClusterEndpointPort: - Value: !GetAtt ElasticacheCluster.ConfigurationEndpoint.Port - Export: - Name: !Sub '${AWS::Region}-${AWS::StackName}-ElasticacheClusterEndpointPort' - RedisEndpointAddress: Value: !GetAtt ElasticacheCluster.RedisEndpoint.Address Export: @@ -56,3 +50,6 @@ Outputs: Value: !GetAtt ElasticacheCluster.RedisEndpoint.Port Export: Name: !Sub '${AWS::Region}-${AWS::StackName}-RedisEndpointPort' + + RedisEndpoint: + Value: !Sub 'redis://${ElasticacheCluster.RedisEndpoint.Address}:${ElasticacheCluster.RedisEndpoint.Port}'