1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package elasticache 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/elasticache/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Creates a Redis (cluster mode disabled) or a Redis (cluster mode enabled) 15// replication group. This API can be used to create a standalone regional 16// replication group or a secondary replication group associated with a Global 17// datastore. A Redis (cluster mode disabled) replication group is a collection of 18// clusters, where one of the clusters is a read/write primary and the others are 19// read-only replicas. Writes to the primary are asynchronously propagated to the 20// replicas. A Redis cluster-mode enabled cluster is comprised of from 1 to 90 21// shards (API/CLI: node groups). Each shard has a primary node and up to 5 22// read-only replica nodes. The configuration can range from 90 shards and 0 23// replicas to 15 shards and 5 replicas, which is the maximum number or replicas 24// allowed. The node or shard limit can be increased to a maximum of 500 per 25// cluster if the Redis engine version is 5.0.6 or higher. For example, you can 26// choose to configure a 500 node cluster that ranges between 83 shards (one 27// primary and 5 replicas per shard) and 500 shards (single primary and no 28// replicas). Make sure there are enough available IP addresses to accommodate the 29// increase. Common pitfalls include the subnets in the subnet group have too small 30// a CIDR range or the subnets are shared and heavily used by other clusters. For 31// more information, see Creating a Subnet Group 32// (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/SubnetGroups.Creating.html). 33// For versions below 5.0.6, the limit is 250 per cluster. To request a limit 34// increase, see AWS Service Limits 35// (https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html) and 36// choose the limit type Nodes per cluster per instance type. When a Redis (cluster 37// mode disabled) replication group has been successfully created, you can add one 38// or more read replicas to it, up to a total of 5 read replicas. If you need to 39// increase or decrease the number of node groups (console: shards), you can avail 40// yourself of ElastiCache for Redis' scaling. For more information, see Scaling 41// ElastiCache for Redis Clusters 42// (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Scaling.html) in 43// the ElastiCache User Guide. This operation is valid for Redis only. 44func (c *Client) CreateReplicationGroup(ctx context.Context, params *CreateReplicationGroupInput, optFns ...func(*Options)) (*CreateReplicationGroupOutput, error) { 45 if params == nil { 46 params = &CreateReplicationGroupInput{} 47 } 48 49 result, metadata, err := c.invokeOperation(ctx, "CreateReplicationGroup", params, optFns, addOperationCreateReplicationGroupMiddlewares) 50 if err != nil { 51 return nil, err 52 } 53 54 out := result.(*CreateReplicationGroupOutput) 55 out.ResultMetadata = metadata 56 return out, nil 57} 58 59// Represents the input of a CreateReplicationGroup operation. 60type CreateReplicationGroupInput struct { 61 62 // A user-created description for the replication group. 63 // 64 // This member is required. 65 ReplicationGroupDescription *string 66 67 // The replication group identifier. This parameter is stored as a lowercase 68 // string. Constraints: 69 // 70 // * A name must contain from 1 to 40 alphanumeric characters 71 // or hyphens. 72 // 73 // * The first character must be a letter. 74 // 75 // * A name cannot end with a 76 // hyphen or contain two consecutive hyphens. 77 // 78 // This member is required. 79 ReplicationGroupId *string 80 81 // A flag that enables encryption at rest when set to true. You cannot modify the 82 // value of AtRestEncryptionEnabled after the replication group is created. To 83 // enable encryption at rest on a replication group you must set 84 // AtRestEncryptionEnabled to true when you create the replication group. Required: 85 // Only available when creating a replication group in an Amazon VPC using redis 86 // version 3.2.6, 4.x or later. Default: false 87 AtRestEncryptionEnabled *bool 88 89 // Reserved parameter. The password used to access a password protected server. 90 // AuthToken can be specified only on replication groups where 91 // TransitEncryptionEnabled is true. For HIPAA compliance, you must specify 92 // TransitEncryptionEnabled as true, an AuthToken, and a CacheSubnetGroup. Password 93 // constraints: 94 // 95 // * Must be only printable ASCII characters. 96 // 97 // * Must be at least 16 98 // characters and no more than 128 characters in length. 99 // 100 // * The only permitted 101 // printable special characters are !, &, #, $, ^, <, >, and -. Other printable 102 // special characters cannot be used in the AUTH token. 103 // 104 // For more information, see 105 // AUTH password (http://redis.io/commands/AUTH) at http://redis.io/commands/AUTH. 106 AuthToken *string 107 108 // This parameter is currently disabled. 109 AutoMinorVersionUpgrade *bool 110 111 // Specifies whether a read-only replica is automatically promoted to read/write 112 // primary if the existing primary fails. AutomaticFailoverEnabled must be enabled 113 // for Redis (cluster mode enabled) replication groups. Default: false 114 AutomaticFailoverEnabled *bool 115 116 // The compute and memory capacity of the nodes in the node group (shard). The 117 // following node types are supported by ElastiCache. Generally speaking, the 118 // current generation types provide more memory and computational power at lower 119 // cost when compared to their equivalent previous generation counterparts. 120 // 121 // * 122 // General purpose: 123 // 124 // * Current generation: M6g node types (available only for Redis 125 // engine version 5.0.6 onward and for Memcached engine version 1.5.16 onward). 126 // cache.m6g.large, cache.m6g.xlarge, cache.m6g.2xlarge, cache.m6g.4xlarge, 127 // cache.m6g.8xlarge, cache.m6g.12xlarge, cache.m6g.16xlarge For region 128 // availability, see Supported Node Types 129 // (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheNodes.SupportedTypes.html#CacheNodes.SupportedTypesByRegion) 130 // M5 node types: cache.m5.large, cache.m5.xlarge, cache.m5.2xlarge, 131 // cache.m5.4xlarge, cache.m5.12xlarge, cache.m5.24xlarge M4 node types: 132 // cache.m4.large, cache.m4.xlarge, cache.m4.2xlarge, cache.m4.4xlarge, 133 // cache.m4.10xlarge T3 node types: cache.t3.micro, cache.t3.small, cache.t3.medium 134 // T2 node types: cache.t2.micro, cache.t2.small, cache.t2.medium 135 // 136 // * Previous 137 // generation: (not recommended) T1 node types: cache.t1.micro M1 node types: 138 // cache.m1.small, cache.m1.medium, cache.m1.large, cache.m1.xlarge M3 node types: 139 // cache.m3.medium, cache.m3.large, cache.m3.xlarge, cache.m3.2xlarge 140 // 141 // * Compute 142 // optimized: 143 // 144 // * Previous generation: (not recommended) C1 node types: 145 // cache.c1.xlarge 146 // 147 // * Memory optimized: 148 // 149 // * Current generation: R6g node types 150 // (available only for Redis engine version 5.0.6 onward and for Memcached engine 151 // version 1.5.16 onward). cache.r6g.large, cache.r6g.xlarge, cache.r6g.2xlarge, 152 // cache.r6g.4xlarge, cache.r6g.8xlarge, cache.r6g.12xlarge, cache.r6g.16xlarge For 153 // region availability, see Supported Node Types 154 // (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheNodes.SupportedTypes.html#CacheNodes.SupportedTypesByRegion) 155 // R5 node types: cache.r5.large, cache.r5.xlarge, cache.r5.2xlarge, 156 // cache.r5.4xlarge, cache.r5.12xlarge, cache.r5.24xlarge R4 node types: 157 // cache.r4.large, cache.r4.xlarge, cache.r4.2xlarge, cache.r4.4xlarge, 158 // cache.r4.8xlarge, cache.r4.16xlarge 159 // 160 // * Previous generation: (not recommended) M2 161 // node types: cache.m2.xlarge, cache.m2.2xlarge, cache.m2.4xlarge R3 node types: 162 // cache.r3.large, cache.r3.xlarge, cache.r3.2xlarge, 163 // 164 // cache.r3.4xlarge, 165 // cache.r3.8xlarge 166 // 167 // Additional node type info 168 // 169 // * All current generation instance 170 // types are created in Amazon VPC by default. 171 // 172 // * Redis append-only files (AOF) are 173 // not supported for T1 or T2 instances. 174 // 175 // * Redis Multi-AZ with automatic failover 176 // is not supported on T1 instances. 177 // 178 // * Redis configuration variables appendonly 179 // and appendfsync are not supported on Redis version 2.8.22 and later. 180 CacheNodeType *string 181 182 // The name of the parameter group to associate with this replication group. If 183 // this argument is omitted, the default cache parameter group for the specified 184 // engine is used. If you are running Redis version 3.2.4 or later, only one node 185 // group (shard), and want to use a default parameter group, we recommend that you 186 // specify the parameter group by name. 187 // 188 // * To create a Redis (cluster mode 189 // disabled) replication group, use CacheParameterGroupName=default.redis3.2. 190 // 191 // * To 192 // create a Redis (cluster mode enabled) replication group, use 193 // CacheParameterGroupName=default.redis3.2.cluster.on. 194 CacheParameterGroupName *string 195 196 // A list of cache security group names to associate with this replication group. 197 CacheSecurityGroupNames []string 198 199 // The name of the cache subnet group to be used for the replication group. If 200 // you're going to launch your cluster in an Amazon VPC, you need to create a 201 // subnet group before you start creating a cluster. For more information, see 202 // Subnets and Subnet Groups 203 // (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/SubnetGroups.html). 204 CacheSubnetGroupName *string 205 206 // The name of the cache engine to be used for the clusters in this replication 207 // group. Must be Redis. 208 Engine *string 209 210 // The version number of the cache engine to be used for the clusters in this 211 // replication group. To view the supported cache engine versions, use the 212 // DescribeCacheEngineVersions operation. Important: You can upgrade to a newer 213 // engine version (see Selecting a Cache Engine and Version 214 // (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/SelectEngine.html#VersionManagement)) 215 // in the ElastiCache User Guide, but you cannot downgrade to an earlier engine 216 // version. If you want to use an earlier engine version, you must delete the 217 // existing cluster or replication group and create it anew with the earlier engine 218 // version. 219 EngineVersion *string 220 221 // The name of the Global datastore 222 GlobalReplicationGroupId *string 223 224 // The ID of the KMS key used to encrypt the disk in the cluster. 225 KmsKeyId *string 226 227 // A flag indicating if you have Multi-AZ enabled to enhance fault tolerance. For 228 // more information, see Minimizing Downtime: Multi-AZ 229 // (http://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/AutoFailover.html). 230 MultiAZEnabled *bool 231 232 // A list of node group (shard) configuration options. Each node group (shard) 233 // configuration has the following members: PrimaryAvailabilityZone, 234 // ReplicaAvailabilityZones, ReplicaCount, and Slots. If you're creating a Redis 235 // (cluster mode disabled) or a Redis (cluster mode enabled) replication group, you 236 // can use this parameter to individually configure each node group (shard), or you 237 // can omit this parameter. However, it is required when seeding a Redis (cluster 238 // mode enabled) cluster from a S3 rdb file. You must configure each node group 239 // (shard) using this parameter because you must specify the slots for each node 240 // group. 241 NodeGroupConfiguration []types.NodeGroupConfiguration 242 243 // The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) 244 // topic to which notifications are sent. The Amazon SNS topic owner must be the 245 // same as the cluster owner. 246 NotificationTopicArn *string 247 248 // The number of clusters this replication group initially has. This parameter is 249 // not used if there is more than one node group (shard). You should use 250 // ReplicasPerNodeGroup instead. If AutomaticFailoverEnabled is true, the value of 251 // this parameter must be at least 2. If AutomaticFailoverEnabled is false you can 252 // omit this parameter (it will default to 1), or you can explicitly set it to a 253 // value between 2 and 6. The maximum permitted value for NumCacheClusters is 6 (1 254 // primary plus 5 replicas). 255 NumCacheClusters *int32 256 257 // An optional parameter that specifies the number of node groups (shards) for this 258 // Redis (cluster mode enabled) replication group. For Redis (cluster mode 259 // disabled) either omit this parameter or set it to 1. Default: 1 260 NumNodeGroups *int32 261 262 // The port number on which each member of the replication group accepts 263 // connections. 264 Port *int32 265 266 // A list of EC2 Availability Zones in which the replication group's clusters are 267 // created. The order of the Availability Zones in the list is the order in which 268 // clusters are allocated. The primary cluster is created in the first AZ in the 269 // list. This parameter is not used if there is more than one node group (shard). 270 // You should use NodeGroupConfiguration instead. If you are creating your 271 // replication group in an Amazon VPC (recommended), you can only locate clusters 272 // in Availability Zones associated with the subnets in the selected subnet group. 273 // The number of Availability Zones listed must equal the value of 274 // NumCacheClusters. Default: system chosen Availability Zones. 275 PreferredCacheClusterAZs []string 276 277 // Specifies the weekly time range during which maintenance on the cluster is 278 // performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H 279 // Clock UTC). The minimum maintenance window is a 60 minute period. Valid values 280 // for ddd are: Specifies the weekly time range during which maintenance on the 281 // cluster is performed. It is specified as a range in the format 282 // ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 283 // minute period. Valid values for ddd are: 284 // 285 // * sun 286 // 287 // * mon 288 // 289 // * tue 290 // 291 // * wed 292 // 293 // * thu 294 // 295 // * 296 // fri 297 // 298 // * sat 299 // 300 // Example: sun:23:00-mon:01:30 301 PreferredMaintenanceWindow *string 302 303 // The identifier of the cluster that serves as the primary for this replication 304 // group. This cluster must already exist and have a status of available. This 305 // parameter is not required if NumCacheClusters, NumNodeGroups, or 306 // ReplicasPerNodeGroup is specified. 307 PrimaryClusterId *string 308 309 // An optional parameter that specifies the number of replica nodes in each node 310 // group (shard). Valid values are 0 to 5. 311 ReplicasPerNodeGroup *int32 312 313 // One or more Amazon VPC security groups associated with this replication group. 314 // Use this parameter only when you are creating a replication group in an Amazon 315 // Virtual Private Cloud (Amazon VPC). 316 SecurityGroupIds []string 317 318 // A list of Amazon Resource Names (ARN) that uniquely identify the Redis RDB 319 // snapshot files stored in Amazon S3. The snapshot files are used to populate the 320 // new replication group. The Amazon S3 object name in the ARN cannot contain any 321 // commas. The new replication group will have the number of node groups (console: 322 // shards) specified by the parameter NumNodeGroups or the number of node groups 323 // configured by NodeGroupConfiguration regardless of the number of ARNs specified 324 // here. Example of an Amazon S3 ARN: arn:aws:s3:::my_bucket/snapshot1.rdb 325 SnapshotArns []string 326 327 // The name of a snapshot from which to restore data into the new replication 328 // group. The snapshot status changes to restoring while the new replication group 329 // is being created. 330 SnapshotName *string 331 332 // The number of days for which ElastiCache retains automatic snapshots before 333 // deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot 334 // that was taken today is retained for 5 days before being deleted. Default: 0 335 // (i.e., automatic backups are disabled for this cluster). 336 SnapshotRetentionLimit *int32 337 338 // The daily time range (in UTC) during which ElastiCache begins taking a daily 339 // snapshot of your node group (shard). Example: 05:00-09:00 If you do not specify 340 // this parameter, ElastiCache automatically chooses an appropriate time range. 341 SnapshotWindow *string 342 343 // A list of tags to be added to this resource. Tags are comma-separated key,value 344 // pairs (e.g. Key=myKey, Value=myKeyValue. You can include multiple tags as shown 345 // following: Key=myKey, Value=myKeyValue Key=mySecondKey, Value=mySecondKeyValue. 346 // Tags on replication groups will be replicated to all nodes. 347 Tags []types.Tag 348 349 // A flag that enables in-transit encryption when set to true. You cannot modify 350 // the value of TransitEncryptionEnabled after the cluster is created. To enable 351 // in-transit encryption on a cluster you must set TransitEncryptionEnabled to true 352 // when you create a cluster. This parameter is valid only if the Engine parameter 353 // is redis, the EngineVersion parameter is 3.2.6, 4.x or later, and the cluster is 354 // being created in an Amazon VPC. If you enable in-transit encryption, you must 355 // also specify a value for CacheSubnetGroup. Required: Only available when 356 // creating a replication group in an Amazon VPC using redis version 3.2.6, 4.x or 357 // later. Default: false For HIPAA compliance, you must specify 358 // TransitEncryptionEnabled as true, an AuthToken, and a CacheSubnetGroup. 359 TransitEncryptionEnabled *bool 360 361 // The list of user groups to associate with the replication group. 362 UserGroupIds []string 363} 364 365type CreateReplicationGroupOutput struct { 366 367 // Contains all of the attributes of a specific Redis replication group. 368 ReplicationGroup *types.ReplicationGroup 369 370 // Metadata pertaining to the operation's result. 371 ResultMetadata middleware.Metadata 372} 373 374func addOperationCreateReplicationGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { 375 err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateReplicationGroup{}, middleware.After) 376 if err != nil { 377 return err 378 } 379 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateReplicationGroup{}, middleware.After) 380 if err != nil { 381 return err 382 } 383 if err = addSetLoggerMiddleware(stack, options); err != nil { 384 return err 385 } 386 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 387 return err 388 } 389 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 390 return err 391 } 392 if err = addResolveEndpointMiddleware(stack, options); err != nil { 393 return err 394 } 395 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 396 return err 397 } 398 if err = addRetryMiddlewares(stack, options); err != nil { 399 return err 400 } 401 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 402 return err 403 } 404 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 405 return err 406 } 407 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 408 return err 409 } 410 if err = addClientUserAgent(stack); err != nil { 411 return err 412 } 413 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 414 return err 415 } 416 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 417 return err 418 } 419 if err = addOpCreateReplicationGroupValidationMiddleware(stack); err != nil { 420 return err 421 } 422 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateReplicationGroup(options.Region), middleware.Before); err != nil { 423 return err 424 } 425 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 426 return err 427 } 428 if err = addResponseErrorMiddleware(stack); err != nil { 429 return err 430 } 431 if err = addRequestResponseLogging(stack, options); err != nil { 432 return err 433 } 434 return nil 435} 436 437func newServiceMetadataMiddleware_opCreateReplicationGroup(region string) *awsmiddleware.RegisterServiceMetadata { 438 return &awsmiddleware.RegisterServiceMetadata{ 439 Region: region, 440 ServiceID: ServiceID, 441 SigningName: "elasticache", 442 OperationName: "CreateReplicationGroup", 443 } 444} 445