Source: resources/elasticache.js

  1. 'use strict'
  2. const WKResource = require('./../resource').WKResource
  3. const ResourceAttribute = require('./../resourceattribute').ResourceAttribute
  4. const ResourceAttributeArray = require('./../resourceattribute').ResourceAttributeArray
  5. const tag = require('./../tag')
  6. const types = require('./../types')
  7. /** @module ElastiCache */
  8. /** @memberof module:ElastiCache
  9. * @extends WKResource
  10. * @property {Boolean} AutoMinorVersionUpgrade Required: No. Indicates that minor engine upgrades will be applied automatically to the cache
  11. cluster during the maintenance window.Default: trueUpdate requires: No interruption
  12. * @property {String} AZMode Required: Conditional. For Memcached cache clusters, indicates whether the nodes are created in a
  13. single Availability Zone or across multiple Availability Zones in the cluster's
  14. region. For valid values, see CreateCacheCluster in
  15. the Amazon ElastiCache API Reference.Update requires: No interruption
  16. * @property {String} CacheNodeType Required: Yes. The compute and memory capacity of nodes in a cache cluster.Update requires: Replacement
  17. * @property {String} CacheParameterGroupName Required: No. The name of the cache parameter group that is associated with this cache
  18. cluster.Update requires: Some interruptions
  19. * @property {String} CacheSecurityGroupNames Required: Conditional. A list of cache security group names that are associated with this cache
  20. cluster. If your cache cluster is in a VPC, specify the
  21. VpcSecurityGroupIds property instead.Update requires: No interruption
  22. * @property {String} CacheSubnetGroupName Required: Conditional. The cache subnet group that you associate with a cache cluster.Update requires: Replacement
  23. * @property {String} ClusterName Required: No. A name for the cache cluster. If you don't specify a name, AWS CloudFormation generates a
  24. unique physical ID and uses that ID for the cache cluster. For more information,
  25. see Name Type.ImportantIf you specify a name, you cannot do updates that require this resource to be replaced.
  26. You can still do updates that require no or some interruption. If you must replace the resource, specify a new name.The name must contain 1 to 20 alphanumeric characters or hyphens. The name must
  27. start with a letter and cannot end with a hyphen or contain two consecutive
  28. hyphens.Update requires: Replacement
  29. * @property {String} Engine Required: Yes. The name of the cache engine to be used for this cache cluster, such as
  30. memcached or redis.Update requires: Replacement
  31. * @property {String} EngineVersion Required: No. The version of the cache engine to be used for this cluster.Update requires: Some interruptions
  32. * @property {String} NotificationTopicArn Required: No. The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS)
  33. topic to which notifications will be sent.Update requires: No interruption
  34. * @property {String} NumCacheNodes Required: Yes. The number of cache nodes that the cache cluster should have.Update requires: No interruption. However, if the PreferredAvailabilityZone
  35. and PreferredAvailabilityZones properties were not previously
  36. specified and you don't specify any new values, an update requires replacement.
  37. * @property {Number} Port Required: No. The port number on which each of the cache nodes will accept
  38. connections.Update requires: Replacement
  39. * @property {String} PreferredAvailabilityZone Required: No. The Amazon EC2 Availability Zone in which the cache cluster is created.Update requires: Replacement
  40. * @property {String} PreferredAvailabilityZones Required: No. For Memcached cache clusters, the list of Availability Zones in which cache
  41. nodes are created. The number of Availability Zones listed must equal the number
  42. of cache nodes. For example, if you want to create three nodes in two different
  43. Availability Zones, you can specify ["us-east-1a", "us-east-1a",
  44. "us-east-1b"], which would create two nodes in us-east-1a and one node
  45. in us-east-1b.If you specify a subnet group and you're creating your cache cluster in a VPC,
  46. you must specify Availability Zones that are associated with the subnets in the
  47. subnet group that you've chosen.If you want all the nodes in the same Availability Zone, use the
  48. PreferredAvailabilityZone property or repeat the Availability Zone
  49. multiple times in the list.If you specify an Availability Zone that was previously specified in the
  50. template, such as in the PreferredAvailabilityZone property, the
  51. update requires some interruptions.
  52. Also, if the PreferredAvailabilityZones property was already
  53. specified and you're updating its values (regardless of whether you specify the
  54. same Availability Zones), the update requires some interruptions.All other updates require replacement.
  55. * @property {String} PreferredMaintenanceWindow Required: No. The weekly time range (in UTC) during which system maintenance can
  56. occur.Update requires: No interruption
  57. * @property {String} SnapshotArns Required: No. The ARN of the snapshot file that you want to use to seed a new Redis cache
  58. cluster. If you manage a Redis instance outside of Amazon ElastiCache, you can create a new
  59. cache cluster in ElastiCache by using a snapshot file that is stored in an Amazon S3
  60. bucket.Update requires: Replacement
  61. * @property {String} SnapshotName Required: No. The name of a snapshot from which to restore data into a new Redis cache
  62. cluster.Update requires: Replacement
  63. * @property {Number} SnapshotRetentionLimit Required: No. For Redis cache clusters, the number of days for which ElastiCache retains automatic
  64. snapshots before deleting them. For example, if you set the value to
  65. 5, a snapshot that was taken today will be retained for 5 days
  66. before being deleted.Update requires: No interruption
  67. * @property {String} SnapshotWindow Required: No. For Redis cache clusters, the daily time range (in UTC) during which ElastiCache will
  68. begin taking a daily snapshot of your node group. For example, you can specify
  69. 05:00-09:00.Update requires: No interruption
  70. * @property {AWSCloudFormationResourceTags} Tags Required: No. An arbitrary set of tags (key–value pairs) for this cache
  71. cluster.Update requires: No interruption.
  72. * @property {String} VpcSecurityGroupIds Required: Conditional. A list of VPC security group IDs. If your cache cluster isn't in a VPC, specify
  73. the CacheSecurityGroupNames property instead.
  74. NoteYou must use the AWS::EC2::SecurityGroup resource instead of
  75. the AWS::ElastiCache::SecurityGroup resource in order to
  76. specify an ElastiCache security group that is in a VPC. In addition, if you use
  77. the default VPC for your
  78. AWS account, you must use the Fn::GetAtt function and the
  79. GroupId attribute to retrieve security group IDs (instead of
  80. the Ref function). To see a sample template, see the Template
  81. Snippet section.
  82. Update requires: No interruption
  83. */
  84. class CacheCluster extends WKResource {
  85. constructor (name, propertiesObject) {
  86. let resourceType = 'AWS::ElastiCache::CacheCluster'
  87. let properties = {
  88. AutoMinorVersionUpgrade: new ResourceAttribute('AutoMinorVersionUpgrade', Boolean, 'No', null),
  89. AZMode: new ResourceAttribute('AZMode', String, 'Conditional', null),
  90. CacheNodeType: new ResourceAttribute('CacheNodeType', String, 'Yes', null),
  91. CacheParameterGroupName: new ResourceAttribute('CacheParameterGroupName', String, 'No', null),
  92. CacheSecurityGroupNames: new ResourceAttributeArray('CacheSecurityGroupNames', String, 'Conditional', null),
  93. CacheSubnetGroupName: new ResourceAttribute('CacheSubnetGroupName', String, 'Conditional', null),
  94. ClusterName: new ResourceAttribute('ClusterName', String, 'No', null),
  95. Engine: new ResourceAttribute('Engine', String, 'Yes', null),
  96. EngineVersion: new ResourceAttribute('EngineVersion', String, 'No', null),
  97. NotificationTopicArn: new ResourceAttribute('NotificationTopicArn', String, 'No', null),
  98. NumCacheNodes: new ResourceAttribute('NumCacheNodes', String, 'Yes', null),
  99. Port: new ResourceAttribute('Port', Number, 'No', null),
  100. PreferredAvailabilityZone: new ResourceAttribute('PreferredAvailabilityZone', String, 'No', null),
  101. PreferredAvailabilityZones: new ResourceAttributeArray('PreferredAvailabilityZones', String, 'No', null),
  102. PreferredMaintenanceWindow: new ResourceAttribute('PreferredMaintenanceWindow', String, 'No', null),
  103. SnapshotArns: new ResourceAttributeArray('SnapshotArns', String, 'No', null),
  104. SnapshotName: new ResourceAttribute('SnapshotName', String, 'No', null),
  105. SnapshotRetentionLimit: new ResourceAttribute('SnapshotRetentionLimit', Number, 'No', null),
  106. SnapshotWindow: new ResourceAttribute('SnapshotWindow', String, 'No', null),
  107. Tags: new tag.TagSet(),
  108. VpcSecurityGroupIds: new ResourceAttributeArray('VpcSecurityGroupIds', String, 'Conditional', null)
  109. }
  110. super(name, resourceType, properties, propertiesObject)
  111. }
  112. }
  113. /** @memberof module:ElastiCache
  114. * @extends WKResource
  115. * @property {String} CacheParameterGroupFamily Required: Yes. The name of the cache parameter group family that the cache parameter group can be used
  116. with.Update requires: Updates are not supported.
  117. * @property {String} Description Required: Yes. The description for the Cache Parameter Group.Update requires: Updates are not supported.
  118. * @property {Map} Properties Required: No. A comma-delimited list of parameter name/value pairs. For more information, go to ModifyCacheParameterGroup in the Amazon ElastiCache API Reference
  119. Guide.Example:Update requires: Updates are not supported.
  120. */
  121. class ParameterGroup extends WKResource {
  122. constructor (name, propertiesObject) {
  123. let resourceType = 'AWS::ElastiCache::ParameterGroup'
  124. let properties = {
  125. CacheParameterGroupFamily: new ResourceAttribute('CacheParameterGroupFamily', String, 'Yes', null),
  126. Description: new ResourceAttribute('Description', String, 'Yes', null),
  127. Properties: new ResourceAttribute('Properties', Map, 'No', null)
  128. }
  129. super(name, resourceType, properties, propertiesObject)
  130. }
  131. }
  132. /** @memberof module:ElastiCache
  133. * @extends WKResource
  134. * @property {Boolean} AutomaticFailoverEnabled Required: No. Indicates whether Multi-AZ is enabled. When Multi-AZ is enabled, a read-only
  135. replica is automatically promoted to a read-write primary cluster if the existing
  136. primary cluster fails. If you specify true, you must specify a value
  137. greater than 1 for the NumCacheNodes property. By
  138. default, AWS CloudFormation sets the value to true.For more information about Multi-AZ, see Multi-AZ with Redis Replication Groups in the
  139. Amazon ElastiCache User Guide.NoteYou cannot enable automatic failover for Redis versions earlier than 2.8.6
  140. or for T1 and T2 cache node types.Update requires: No interruption
  141. * @property {Boolean} AutoMinorVersionUpgrade Required: No. Currently, this property isn't used by ElastiCache.Update requires: No interruption
  142. * @property {String} CacheNodeType Required: Yes. The compute and memory capacity of nodes in the node group. To see valid
  143. values, see CreateReplicationGroup in the Amazon ElastiCache API
  144. Reference Guide.Update requires: Replacement
  145. * @property {String} CacheParameterGroupName Required: No. The name of the parameter group to associate with this replication
  146. group.Update requires: No interruption
  147. * @property {String} CacheSecurityGroupNames Required: No. A list of cache security group names to associate with this replication group.
  148. If you specify the SecurityGroupIds property, do not specify this
  149. property; you can specify only one.Update requires: No interruption
  150. * @property {String} CacheSubnetGroupName Required: No. The name of a cache subnet group to use for this replication group.Update requires: Replacement
  151. * @property {String} Engine Required: Yes. The name of the cache engine to use for the cache clusters in this replication
  152. group. Currently, you can specify only redis.Update requires: Replacement
  153. * @property {String} EngineVersion Required: No. The version number of the cache engine to use for the cache clusters in this
  154. replication group.Update requires: No interruption
  155. * @property {String} NotificationTopicArn Required: No. The Amazon Resource Name (ARN) of the Amazon Simple Notification Service topic to which notifications are
  156. sent.Update requires: No interruption
  157. * @property {Number} NumCacheClusters Required: Yes. The number of cache clusters for this replication group. If automatic failover
  158. is enabled, you must specify a value greater than 1.Update requires: Replacement
  159. * @property {Number} Port Required: No. The port number on which each member of the replication group accepts
  160. connections.Update requires: Replacement
  161. * @property {String} PreferredCacheClusterAZs Required: No. A list of Availability Zones (AZs) in which the cache clusters in this
  162. replication group are created.Update requires: Replacement
  163. * @property {String} PreferredMaintenanceWindow Required: No. The weekly time range during which system maintenance can occur. Use the
  164. following format to specify a time range: ddd:hh24:mi-ddd:hh24:mi
  165. (24H Clock UTC). For example, you can specify sun:22:00-sun:23:30 for
  166. Sunday from 10 PM to 11:30 PM.Update requires: No interruption
  167. * @property {String} ReplicationGroupDescription Required: Yes. The description of the replication group.Update requires: No interruption
  168. * @property {String} SecurityGroupIds Required: No. A list of Amazon Virtual Private Cloud (Amazon VPC) security groups to associate with this replication
  169. group. Use this property only when you are creating a replication group in a VPC.
  170. If you specify the CacheSecurityGroupNames property, do not specify
  171. this property; you can specify only one.Update requires: No interruption
  172. * @property {String} SnapshotArns Required: No. A single-element string list that specifies an ARN of a Redis
  173. .rdb snapshot file that is stored in Amazon Simple Storage Service (Amazon S3). The
  174. snapshot file populates the node group. The Amazon S3 object name in the ARN cannot
  175. contain commas. For example, you can specify
  176. arn:aws:s3:::my_bucket/snapshot1.rdb.Update requires: Replacement
  177. * @property {Number} SnapshotRetentionLimit Required: No. The number of days that ElastiCache retains automatic snapshots before deleting
  178. them.Update requires: No interruption
  179. * @property {String} SnapshotWindow Required: No. The time range (in UTC) when ElastiCache takes a daily snapshot of your node group.
  180. For example, you can specify 05:00-09:00.Update requires: No interruption
  181. */
  182. class ReplicationGroup extends WKResource {
  183. constructor (name, propertiesObject) {
  184. let resourceType = 'AWS::ElastiCache::ReplicationGroup'
  185. let properties = {
  186. AutomaticFailoverEnabled: new ResourceAttribute('AutomaticFailoverEnabled', Boolean, 'No', null),
  187. AutoMinorVersionUpgrade: new ResourceAttribute('AutoMinorVersionUpgrade', Boolean, 'No', null),
  188. CacheNodeType: new ResourceAttribute('CacheNodeType', String, 'Yes', null),
  189. CacheParameterGroupName: new ResourceAttribute('CacheParameterGroupName', String, 'No', null),
  190. CacheSecurityGroupNames: new ResourceAttributeArray('CacheSecurityGroupNames', String, 'No', null),
  191. CacheSubnetGroupName: new ResourceAttribute('CacheSubnetGroupName', String, 'No', null),
  192. Engine: new ResourceAttribute('Engine', String, 'Yes', null),
  193. EngineVersion: new ResourceAttribute('EngineVersion', String, 'No', null),
  194. NotificationTopicArn: new ResourceAttribute('NotificationTopicArn', String, 'No', null),
  195. NumCacheClusters: new ResourceAttribute('NumCacheClusters', Number, 'Yes', null),
  196. Port: new ResourceAttribute('Port', Number, 'No', null),
  197. PreferredCacheClusterAZs: new ResourceAttributeArray('PreferredCacheClusterAZs', String, 'No', null),
  198. PreferredMaintenanceWindow: new ResourceAttribute('PreferredMaintenanceWindow', String, 'No', null),
  199. ReplicationGroupDescription: new ResourceAttribute('ReplicationGroupDescription', String, 'Yes', null),
  200. SecurityGroupIds: new ResourceAttributeArray('SecurityGroupIds', String, 'No', null),
  201. SnapshotArns: new ResourceAttributeArray('SnapshotArns', String, 'No', null),
  202. SnapshotRetentionLimit: new ResourceAttribute('SnapshotRetentionLimit', Number, 'No', null),
  203. SnapshotWindow: new ResourceAttribute('SnapshotWindow', String, 'No', null)
  204. }
  205. super(name, resourceType, properties, propertiesObject)
  206. }
  207. }
  208. /** @memberof module:ElastiCache
  209. * @extends WKResource
  210. * @property {String} Description Required: No. A description for the cache security group.Update requires: Updates are not supported.
  211. */
  212. class SecurityGroup extends WKResource {
  213. constructor (name, propertiesObject) {
  214. let resourceType = 'AWS::ElastiCache::SecurityGroup'
  215. let properties = {
  216. Description: new ResourceAttribute('Description', String, 'No', null)
  217. }
  218. super(name, resourceType, properties, propertiesObject)
  219. }
  220. }
  221. /** @memberof module:ElastiCache
  222. * @extends WKResource
  223. * @property {String} CacheSecurityGroupName Required: Yes. The name of the Cache Security Group to authorize.Update requires: Updates are not supported.
  224. * @property {String} EC2SecurityGroupName Required: Yes. Name of the EC2 Security Group to include in the authorization.Update requires: Updates are not supported.
  225. * @property {String} EC2SecurityGroupOwnerId Required: No. Specifies the AWS Account ID of the owner of the EC2 security group specified
  226. in the EC2SecurityGroupName property. The AWS access key ID is not an acceptable
  227. value.Update requires: Updates are not supported.
  228. */
  229. class SecurityGroupIngress extends WKResource {
  230. constructor (name, propertiesObject) {
  231. let resourceType = 'AWS::ElastiCache::SecurityGroupIngress'
  232. let properties = {
  233. CacheSecurityGroupName: new ResourceAttribute('CacheSecurityGroupName', String, 'Yes', null),
  234. EC2SecurityGroupName: new ResourceAttribute('EC2SecurityGroupName', String, 'Yes', null),
  235. EC2SecurityGroupOwnerId: new ResourceAttribute('EC2SecurityGroupOwnerId', String, 'No', null)
  236. }
  237. super(name, resourceType, properties, propertiesObject)
  238. }
  239. }
  240. /** @memberof module:ElastiCache
  241. * @extends WKResource
  242. * @property {String} Description Required: Yes. The description for the cache subnet group.Update requires: No interruption
  243. * @property {String} SubnetIds Required: Yes. The Amazon EC2 subnet IDs for the cache subnet group.Update requires: No interruption
  244. */
  245. class SubnetGroup extends WKResource {
  246. constructor (name, propertiesObject) {
  247. let resourceType = 'AWS::ElastiCache::SubnetGroup'
  248. let properties = {
  249. Description: new ResourceAttribute('Description', String, 'Yes', null),
  250. SubnetIds: new ResourceAttributeArray('SubnetIds', String, 'Yes', null)
  251. }
  252. super(name, resourceType, properties, propertiesObject)
  253. }
  254. }
  255. module.exports = { CacheCluster: CacheCluster,
  256. ParameterGroup: ParameterGroup,
  257. ReplicationGroup: ReplicationGroup,
  258. SecurityGroup: SecurityGroup,
  259. SecurityGroupIngress: SecurityGroupIngress,
  260. SubnetGroup: SubnetGroup
  261. }