<commit_before>---
# Copyright 2018 widdix GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
AWSTemplateFormatVersion: '2010-09-09'
Description: 'State: ElastiCache redis, a cloudonaut.io template'
Metadata:
  'AWS::CloudFormation::Interface':
    ParameterGroups:
    - Label:
        default: 'Parent Stacks'
      Parameters:
      - ParentVPCStack
      - ParentClientStack
      - ParentKmsKeyStack
      - ParentZoneStack
      - ParentSSHBastionStack
      - ParentAlertStack
    - Label:
        default: 'ElastiCache Parameters'
      Parameters:
      - EngineVersion
      - CacheNodeType
      - TransitEncryption
      - AuthToken
      - SnapshotRetentionLimit
      - SnapshotName
      - SubDomainName
      - NumShards
      - NumReplicas
    - Label:
        default: 'Alerting Parameters'
      Parameters:
      - CPUUtilizationThreshold
      - DatabaseMemoryUsagePercentageThreshold
      - SwapUsageThreshold
      - EvictionsThreshold
      - ReplicationLagThreshold
Parameters:
  ParentVPCStack:
    Description: 'Stack name of parent VPC stack based on vpc/vpc-*azs.yaml template.'
    Type: String
  ParentClientStack:
    Description: 'Stack name of parent client stack based on state/client-sg.yaml template.'
    Type: String
  ParentKmsKeyStack:
    Description: 'Optional stack name of parent KMS key stack based on security/kms-key.yaml template.'
    Type: String
    Default: ''
  ParentZoneStack:
    Description: 'Optional stack name of parent zone stack based on vpc/vpc-zone-*.yaml template.'
    Type: String
    Default: ''
  ParentSSHBastionStack:
    Description: 'Optional but recommended stack name of parent SSH bastion host/instance stack based on vpc/vpc-ssh-bastion.yaml template.'
    Type: String
    Default: ''
  ParentAlertStack:
    Description: 'Optional but recommended stack name of parent alert stack based on operations/alert.yaml template.'
    Type: String
    Default: ''
  EngineVersion:
    Description: 'Redis version'
    Type: String
    Default: '5.0.0'
    AllowedValues: # aws elasticache describe-cache-engine-versions --engine redis --query "CacheEngineVersions[].EngineVersion"
    - '5.0.4'
    - '5.0.0'
    - '4.0.10'
    - '3.2.6' # 3.2.4 and 3.2.10 do not support encryption
  CacheNodeType:
    Description: 'The compute and memory capacity of the nodes in the node group (shard).'
    Type: 'String'
    Default: 'cache.t2.micro'
  TransitEncryption:
    Description: 'Enable encryption for data in transit? (see https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/in-transit-encryption.html)'
    Type: 'String'
    Default: 'true'
    AllowedValues:
    - 'true'
    - 'false'
  AuthToken:
    Description: 'Optional password (16 to 128 characters) used to authenticate against Redis (requires TransitEncryption := true; leave blank to disable password-protection).'
    Type: 'String'
    Default: ''
    MaxLength: 128
  SnapshotRetentionLimit:
    Description: 'The number of days for which ElastiCache retains automatic snapshots before deleting them (set to 0 to disable backups).'
    Type: Number
    Default: 35
    MinValue: 0
    MaxValue: 35
  SnapshotName:
    Description: 'Optional name of a snapshot from which you want to restore (leave blank to create an empty cache).'
    Type: 'String'
    Default: ''
  SubDomainName:
    Description: 'Name that is used to create the DNS entry §{SubDomainName}.§{HostedZoneName} (required when ParentZoneStack is set, otherwise not considered)'
    Type: String
    Default: redis
  NumShards:
    Description: 'Number of shards in the cluster.'
    Type: 'Number'
    Default: 1
    MinValue: 1
    MaxValue: 250
  NumReplicas:
    Description: 'Number of replicas per shard.'
    Type: 'Number'
    Default: 1
    MinValue: 0
    MaxValue: 5
  CPUUtilizationThreshold:
    Description: 'The maximum percentage of CPU usage (set to -1 to disable).'
    Type: Number
    Default: 80
    MinValue: -1
    MaxValue: 100
  DatabaseMemoryUsagePercentageThreshold:
    Description: 'The maximum percentage of memory usage (set to -1 to disable).'
    Type: Number
    Default: 90
    MinValue: -1
    MaxValue: 100
  SwapUsageThreshold:
    Description: 'The maximum bytes of swap usage (set to -1 to disable).'
    Type: Number
    Default: 67108864 # 64 MB in Bytes
    MinValue: -1
  EvictionsThreshold:
    Description: 'The maximum number of evictions (set to -1 to disable).'
    Type: Number
    Default: 1000
    MinValue: -1
  ReplicationLagThreshold:
    Description: 'The maximum seconds of replication lag (set to -1 to disable).'
    Type: Number
    Default: 30
    MinValue: -1
Mappings:
  EngineVersionMap:
    '3.2.6':
      CacheParameterGroupFamily: 'redis3.2'
    '4.0.10':
      CacheParameterGroupFamily: 'redis4.0'
    '5.0.0':
      CacheParameterGroupFamily: 'redis5.0'
    '5.0.4':
      CacheParameterGroupFamily: 'redis5.0'
Conditions:
  HasKmsKey: !Not [!Equals [!Ref ParentKmsKeyStack, '']]
  HasZone: !Not [!Equals [!Ref ParentZoneStack, '']]
  HasSSHBastionSecurityGroup: !Not [!Equals [!Ref ParentSSHBastionStack, '']]
  HasAlertTopic: !Not [!Equals [!Ref ParentAlertStack, '']]
  HasAuthToken: !Not [!Equals [!Ref AuthToken, '']]
  HasSnapshotName: !Not [!Equals [!Ref SnapshotName, '']]
  HasAutomaticFailoverEnabled: !Not [!Equals [!Ref NumReplicas, 0]]
  HasCPUUtilizationThresholdAndAlertTopic: !And [!Not [!Equals [!Ref CPUUtilizationThreshold, '']], !Condition HasAlertTopic]
  HasDatabaseMemoryUsagePercentageThresholdAndAlertTopic: !And [!Not [!Equals [!Ref DatabaseMemoryUsagePercentageThreshold, '']], !Condition HasAlertTopic]
  HasSwapUsageThresholdAndAlertTopic: !And [!Not [!Equals [!Ref SwapUsageThreshold, '']], !Condition HasAlertTopic]
  HasEvictionsThresholdAndAlertTopic: !And [!Not [!Equals [!Ref EvictionsThreshold, '']], !Condition HasAlertTopic]
  HasReplicationLagThresholdAndAlertTopic: !And [!Not [!Equals [!Ref ReplicationLagThreshold, '']], !Condition HasAlertTopic]
Resources:<commit_msg>[Improvement] state/elasticache-redis - Updating available Redis versions (#509)<commit_after>---
# Copyright 2018 widdix GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
AWSTemplateFormatVersion: '2010-09-09'
Description: 'State: ElastiCache redis, a cloudonaut.io template'
Metadata:
  'AWS::CloudFormation::Interface':
    ParameterGroups:
    - Label:
        default: 'Parent Stacks'
      Parameters:
      - ParentVPCStack
      - ParentClientStack
      - ParentKmsKeyStack
      - ParentZoneStack
      - ParentSSHBastionStack
      - ParentAlertStack
    - Label:
        default: 'ElastiCache Parameters'
      Parameters:
      - EngineVersion
      - CacheNodeType
      - TransitEncryption
      - AuthToken
      - SnapshotRetentionLimit
      - SnapshotName
      - SubDomainName
      - NumShards
      - NumReplicas
    - Label:
        default: 'Alerting Parameters'
      Parameters:
      - CPUUtilizationThreshold
      - DatabaseMemoryUsagePercentageThreshold
      - SwapUsageThreshold
      - EvictionsThreshold
      - ReplicationLagThreshold
Parameters:
  ParentVPCStack:
    Description: 'Stack name of parent VPC stack based on vpc/vpc-*azs.yaml template.'
    Type: String
  ParentClientStack:
    Description: 'Stack name of parent client stack based on state/client-sg.yaml template.'
    Type: String
  ParentKmsKeyStack:
    Description: 'Optional stack name of parent KMS key stack based on security/kms-key.yaml template.'
    Type: String
    Default: ''
  ParentZoneStack:
    Description: 'Optional stack name of parent zone stack based on vpc/vpc-zone-*.yaml template.'
    Type: String
    Default: ''
  ParentSSHBastionStack:
    Description: 'Optional but recommended stack name of parent SSH bastion host/instance stack based on vpc/vpc-ssh-bastion.yaml template.'
    Type: String
    Default: ''
  ParentAlertStack:
    Description: 'Optional but recommended stack name of parent alert stack based on operations/alert.yaml template.'
    Type: String
    Default: ''
  EngineVersion:
    Description: 'Redis version'
    Type: String
    Default: '5.0.0'
    AllowedValues: # aws elasticache describe-cache-engine-versions --engine redis --query "CacheEngineVersions[].EngineVersion"
    - '3.2.6' # 3.2.4 and 3.2.10 do not support encryption
    - '4.0.10'
    - '5.0.0'
    - '5.0.3'
    - '5.0.4'
    - '5.0.5'
    - '5.0.6'
    - '6.x'
  CacheNodeType:
    Description: 'The compute and memory capacity of the nodes in the node group (shard).'
    Type: 'String'
    Default: 'cache.t2.micro'
  TransitEncryption:
    Description: 'Enable encryption for data in transit? (see https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/in-transit-encryption.html)'
    Type: 'String'
    Default: 'true'
    AllowedValues:
    - 'true'
    - 'false'
  AuthToken:
    Description: 'Optional password (16 to 128 characters) used to authenticate against Redis (requires TransitEncryption := true; leave blank to disable password-protection).'
    Type: 'String'
    Default: ''
    MaxLength: 128
  SnapshotRetentionLimit:
    Description: 'The number of days for which ElastiCache retains automatic snapshots before deleting them (set to 0 to disable backups).'
    Type: Number
    Default: 35
    MinValue: 0
    MaxValue: 35
  SnapshotName:
    Description: 'Optional name of a snapshot from which you want to restore (leave blank to create an empty cache).'
    Type: 'String'
    Default: ''
  SubDomainName:
    Description: 'Name that is used to create the DNS entry §{SubDomainName}.§{HostedZoneName} (required when ParentZoneStack is set, otherwise not considered)'
    Type: String
    Default: redis
  NumShards:
    Description: 'Number of shards in the cluster.'
    Type: 'Number'
    Default: 1
    MinValue: 1
    MaxValue: 250
  NumReplicas:
    Description: 'Number of replicas per shard.'
    Type: 'Number'
    Default: 1
    MinValue: 0
    MaxValue: 5
  CPUUtilizationThreshold:
    Description: 'The maximum percentage of CPU usage (set to -1 to disable).'
    Type: Number
    Default: 80
    MinValue: -1
    MaxValue: 100
  DatabaseMemoryUsagePercentageThreshold:
    Description: 'The maximum percentage of memory usage (set to -1 to disable).'
    Type: Number
    Default: 90
    MinValue: -1
    MaxValue: 100
  SwapUsageThreshold:
    Description: 'The maximum bytes of swap usage (set to -1 to disable).'
    Type: Number
    Default: 67108864 # 64 MB in Bytes
    MinValue: -1
  EvictionsThreshold:
    Description: 'The maximum number of evictions (set to -1 to disable).'
    Type: Number
    Default: 1000
    MinValue: -1
  ReplicationLagThreshold:
    Description: 'The maximum seconds of replication lag (set to -1 to disable).'
    Type: Number
    Default: 30
    MinValue: -1
Mappings:
  EngineVersionMap:
    '3.2.6':
      CacheParameterGroupFamily: 'redis3.2'
    '4.0.10':
      CacheParameterGroupFamily: 'redis4.0'
    '5.0.0':
      CacheParameterGroupFamily: 'redis5.0'
    '5.0.3':
      CacheParameterGroupFamily: 'redis5.0'
    '5.0.4':
      CacheParameterGroupFamily: 'redis5.0'
    '5.0.5':
      CacheParameterGroupFamily: 'redis5.0'
    '5.0.6':
      CacheParameterGroupFamily: 'redis5.0'
    '6.x':
      CacheParameterGroupFamily: 'redis6.x'
Conditions:
  HasKmsKey: !Not [!Equals [!Ref ParentKmsKeyStack, '']]
  HasZone: !Not [!Equals [!Ref ParentZoneStack, '']]
  HasSSHBastionSecurityGroup: !Not [!Equals [!Ref ParentSSHBastionStack, '']]
  HasAlertTopic: !Not [!Equals [!Ref ParentAlertStack, '']]
  HasAuthToken: !Not [!Equals [!Ref AuthToken, '']]
  HasSnapshotName: !Not [!Equals [!Ref SnapshotName, '']]
  HasAutomaticFailoverEnabled: !Not [!Equals [!Ref NumReplicas, 0]]
  HasCPUUtilizationThresholdAndAlertTopic: !And [!Not [!Equals [!Ref CPUUtilizationThreshold, '']], !Condition HasAlertTopic]
  HasDatabaseMemoryUsagePercentageThresholdAndAlertTopic: !And [!Not [!Equals [!Ref DatabaseMemoryUsagePercentageThreshold, '']], !Condition HasAlertTopic]
  HasSwapUsageThresholdAndAlertTopic: !And [!Not [!Equals [!Ref SwapUsageThreshold, '']], !Condition HasAlertTopic]
  HasEvictionsThresholdAndAlertTopic: !And [!Not [!Equals [!Ref EvictionsThreshold, '']], !Condition HasAlertTopic]
  HasReplicationLagThresholdAndAlertTopic: !And [!Not [!Equals [!Ref ReplicationLagThreshold, '']], !Condition HasAlertTopic]
Resources:
{'fraction_non_alphanumeric': 0.09613798275215599, 'fraction_numerical': 0.020247469066366704, 'mean_word_length': 3.4706671136439824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6860500', 'n_tokens_mistral': 4120, 'n_tokens_neox': 3935, 'n_words': 1261}