Package com.pulumi.aws.elasticache
Class Cluster
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.elasticache.Cluster
-
public class Cluster extends com.pulumi.resources.CustomResourceProvides an ElastiCache Cluster resource, which manages a Memcached cluster, a single-node Redis instance, or a read replica in a Redis (Cluster Mode Enabled) replication group. For more information, refer to the AWS document [What is Amazon ElastiCache?](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/WhatIs.html). For working with Redis (Cluster Mode Enabled) replication groups, see the `aws.elasticache.ReplicationGroup` resource. > **Note:** When you change an attribute, such as `numCacheNodes`, by default it is applied in the next maintenance window. Because of this, this provider may report a difference in its planning phase because the actual modification has not yet taken place. You can use the `applyImmediately` flag to instruct the service to apply the change immediately. Using `applyImmediately` can result in a brief downtime as the server reboots. See the "Changes take effect" section of the "Details" column in the AWS Documentation on Engine specific parameters for [ElastiCache for Memcached](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ParameterGroups.Engine.html#ParameterGroups.Memcached) or [ElastiCache for Redis OSS](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ParameterGroups.Engine.html#ParameterGroups.Redis) for more information. > **Note:** Any attribute changes that re-create the resource will be applied immediately, regardless of the value of `applyImmediately`. ## Example Usage ### Memcached Cluster
### Redis Instancepackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.elasticache.Cluster; import com.pulumi.aws.elasticache.ClusterArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Cluster("example", ClusterArgs.builder() .clusterId("cluster-example") .engine("memcached") .nodeType("cache.m4.large") .numCacheNodes(2) .parameterGroupName("default.memcached1.4") .port(11211) .build()); } }
### Redis Cluster Mode Disabled Read Replica Instance These inherit their settings from the replication group.package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.elasticache.Cluster; import com.pulumi.aws.elasticache.ClusterArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Cluster("example", ClusterArgs.builder() .clusterId("cluster-example") .engine("redis") .nodeType("cache.m4.large") .numCacheNodes(1) .parameterGroupName("default.redis3.2") .engineVersion("3.2.10") .port(6379) .build()); } }
### Redis Log Delivery configurationpackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.elasticache.Cluster; import com.pulumi.aws.elasticache.ClusterArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var replica = new Cluster("replica", ClusterArgs.builder() .clusterId("cluster-example") .replicationGroupId(example.id()) .build()); } }
### ElastiCache Cluster in Outpostpackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.elasticache.Cluster; import com.pulumi.aws.elasticache.ClusterArgs; import com.pulumi.aws.elasticache.inputs.ClusterLogDeliveryConfigurationArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var test = new Cluster("test", ClusterArgs.builder() .logDeliveryConfigurations( ClusterLogDeliveryConfigurationArgs.builder() .destination(example.name()) .destinationType("cloudwatch-logs") .logFormat("text") .logType("slow-log") .build(), ClusterLogDeliveryConfigurationArgs.builder() .destination(exampleAwsKinesisFirehoseDeliveryStream.name()) .destinationType("kinesis-firehose") .logFormat("json") .logType("engine-log") .build()) .clusterId("mycluster") .engine("redis") .nodeType("cache.t3.micro") .numCacheNodes(1) .port(6379) .applyImmediately(true) .build()); } }
## Import Using `pulumi import`, import ElastiCache Clusters using the `clusterId`. For example: ```sh $ pulumi import aws:elasticache/cluster:Cluster my_cluster my_cluster ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.outposts.OutpostsFunctions; import com.pulumi.aws.outposts.inputs.GetOutpostsArgs; import com.pulumi.aws.outposts.inputs.GetOutpostArgs; import com.pulumi.aws.ec2.Vpc; import com.pulumi.aws.ec2.VpcArgs; import com.pulumi.aws.ec2.Subnet; import com.pulumi.aws.ec2.SubnetArgs; import com.pulumi.aws.elasticache.SubnetGroup; import com.pulumi.aws.elasticache.SubnetGroupArgs; import com.pulumi.aws.elasticache.Cluster; import com.pulumi.aws.elasticache.ClusterArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { final var example = OutpostsFunctions.getOutposts(GetOutpostsArgs.builder() .build()); final var exampleGetOutpost = OutpostsFunctions.getOutpost(GetOutpostArgs.builder() .id(example.ids()[0]) .build()); var exampleVpc = new Vpc("exampleVpc", VpcArgs.builder() .cidrBlock("10.0.0.0/16") .build()); var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder() .vpcId(exampleVpc.id()) .cidrBlock("10.0.1.0/24") .tags(Map.of("Name", "my-subnet")) .build()); var exampleSubnetGroup = new SubnetGroup("exampleSubnetGroup", SubnetGroupArgs.builder() .name("my-cache-subnet") .subnetIds(exampleSubnet.id()) .build()); var exampleCluster = new Cluster("exampleCluster", ClusterArgs.builder() .clusterId("cluster-example") .outpostMode("single-outpost") .preferredOutpostArn(exampleGetOutpost.arn()) .engine("memcached") .nodeType("cache.r5.large") .numCacheNodes(2) .parameterGroupName("default.memcached1.4") .port(11211) .subnetGroupName(exampleSubnetGroup.name()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description Cluster(java.lang.String name)Cluster(java.lang.String name, ClusterArgs args)Cluster(java.lang.String name, ClusterArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.Boolean>applyImmediately()com.pulumi.core.Output<java.lang.String>arn()com.pulumi.core.Output<java.util.Optional<java.lang.String>>autoMinorVersionUpgrade()com.pulumi.core.Output<java.lang.String>availabilityZone()com.pulumi.core.Output<java.lang.String>azMode()com.pulumi.core.Output<java.util.List<ClusterCacheNode>>cacheNodes()com.pulumi.core.Output<java.lang.String>clusterAddress()com.pulumi.core.Output<java.lang.String>clusterId()com.pulumi.core.Output<java.lang.String>configurationEndpoint()com.pulumi.core.Output<java.lang.String>engine()com.pulumi.core.Output<java.lang.String>engineVersion()com.pulumi.core.Output<java.lang.String>engineVersionActual()com.pulumi.core.Output<java.util.Optional<java.lang.String>>finalSnapshotIdentifier()static Clusterget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ClusterState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>ipDiscovery()com.pulumi.core.Output<java.util.Optional<java.util.List<ClusterLogDeliveryConfiguration>>>logDeliveryConfigurations()com.pulumi.core.Output<java.lang.String>maintenanceWindow()com.pulumi.core.Output<java.lang.String>networkType()com.pulumi.core.Output<java.lang.String>nodeType()com.pulumi.core.Output<java.util.Optional<java.lang.String>>notificationTopicArn()com.pulumi.core.Output<java.lang.Integer>numCacheNodes()com.pulumi.core.Output<java.util.Optional<java.lang.String>>outpostMode()com.pulumi.core.Output<java.lang.String>parameterGroupName()com.pulumi.core.Output<java.lang.Integer>port()com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>>preferredAvailabilityZones()com.pulumi.core.Output<java.lang.String>preferredOutpostArn()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>replicationGroupId()com.pulumi.core.Output<java.util.List<java.lang.String>>securityGroupIds()com.pulumi.core.Output<java.util.Optional<java.lang.String>>snapshotArns()com.pulumi.core.Output<java.util.Optional<java.lang.String>>snapshotName()com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>snapshotRetentionLimit()com.pulumi.core.Output<java.lang.String>snapshotWindow()com.pulumi.core.Output<java.lang.String>subnetGroupName()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()com.pulumi.core.Output<java.lang.Boolean>transitEncryptionEnabled()
-
-
-
Constructor Detail
-
Cluster
public Cluster(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
Cluster
public Cluster(java.lang.String name, @Nullable ClusterArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
Cluster
public Cluster(java.lang.String name, @Nullable ClusterArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
applyImmediately
public com.pulumi.core.Output<java.lang.Boolean> applyImmediately()
- Returns:
- Whether any database modifications are applied immediately, or during the next maintenance window. Default is `false`. See [Amazon ElastiCache Documentation for more information](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_ModifyCacheCluster.html).
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- The ARN of the created ElastiCache Cluster.
-
autoMinorVersionUpgrade
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> autoMinorVersionUpgrade()
- Returns:
- Specifies whether minor version engine upgrades will be applied automatically to the underlying Cache Cluster instances during the maintenance window. Only supported for engine type `"redis"` and if the engine version is 6 or higher. Defaults to `true`.
-
availabilityZone
public com.pulumi.core.Output<java.lang.String> availabilityZone()
- Returns:
- Availability Zone for the cache cluster. If you want to create cache nodes in multi-az, use `preferredAvailabilityZones` instead. Default: System chosen Availability Zone. Changing this value will re-create the resource.
-
azMode
public com.pulumi.core.Output<java.lang.String> azMode()
- Returns:
- Whether the nodes in this Memcached node group are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region. Valid values for this parameter are `single-az` or `cross-az`, default is `single-az`. If you want to choose `cross-az`, `numCacheNodes` must be greater than `1`.
-
cacheNodes
public com.pulumi.core.Output<java.util.List<ClusterCacheNode>> cacheNodes()
- Returns:
- List of node objects including `id`, `address`, `port` and `availabilityZone`.
-
clusterAddress
public com.pulumi.core.Output<java.lang.String> clusterAddress()
- Returns:
- (Memcached only) DNS name of the cache cluster without the port appended.
-
clusterId
public com.pulumi.core.Output<java.lang.String> clusterId()
- Returns:
- Group identifier. ElastiCache converts this name to lowercase. Changing this value will re-create the resource.
-
configurationEndpoint
public com.pulumi.core.Output<java.lang.String> configurationEndpoint()
- Returns:
- (Memcached only) Configuration endpoint to allow host discovery.
-
engine
public com.pulumi.core.Output<java.lang.String> engine()
- Returns:
- Name of the cache engine to be used for this cache cluster. Valid values are `memcached`, `redis`.
-
engineVersion
public com.pulumi.core.Output<java.lang.String> engineVersion()
- Returns:
- Version number of the cache engine to be used. If not set, defaults to the latest version. See [Describe Cache Engine Versions](https://docs.aws.amazon.com/cli/latest/reference/elasticache/describe-cache-engine-versions.html) in the AWS Documentation for supported versions. When `engine` is `redis` and the version is 7 or higher, the major and minor version should be set, e.g., `7.2`. When the version is 6, the major and minor version can be set, e.g., `6.2`, or the minor version can be unspecified which will use the latest version at creation time, e.g., `6.x`. Otherwise, specify the full version desired, e.g., `5.0.6`. The actual engine version used is returned in the attribute `engineVersionActual`, see Attribute Reference below. Cannot be provided with `replication_group_id.`
-
engineVersionActual
public com.pulumi.core.Output<java.lang.String> engineVersionActual()
- Returns:
- Because ElastiCache pulls the latest minor or patch for a version, this attribute returns the running version of the cache engine.
-
finalSnapshotIdentifier
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> finalSnapshotIdentifier()
- Returns:
- Name of your final cluster snapshot. If omitted, no final snapshot will be made.
-
ipDiscovery
public com.pulumi.core.Output<java.lang.String> ipDiscovery()
- Returns:
- The IP version to advertise in the discovery protocol. Valid values are `ipv4` or `ipv6`.
-
logDeliveryConfigurations
public com.pulumi.core.Output<java.util.Optional<java.util.List<ClusterLogDeliveryConfiguration>>> logDeliveryConfigurations()
- Returns:
- Specifies the destination and format of Redis [SLOWLOG](https://redis.io/commands/slowlog) or Redis [Engine Log](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/Log_Delivery.html#Log_contents-engine-log). See the documentation on [Amazon ElastiCache](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/Log_Delivery.html). See Log Delivery Configuration below for more details.
-
maintenanceWindow
public com.pulumi.core.Output<java.lang.String> maintenanceWindow()
- Returns:
- Specifies the weekly time range for when maintenance on the cache cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi` (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example: `sun:05:00-sun:09:00`.
-
networkType
public com.pulumi.core.Output<java.lang.String> networkType()
- Returns:
- The IP versions for cache cluster connections. IPv6 is supported with Redis engine `6.2` onword or Memcached version `1.6.6` for all [Nitro system](https://aws.amazon.com/ec2/nitro/) instances. Valid values are `ipv4`, `ipv6` or `dualStack`.
-
nodeType
public com.pulumi.core.Output<java.lang.String> nodeType()
- Returns:
- The instance class used. See AWS documentation for information on [supported node types for Redis OSS](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/CacheNodes.SupportedTypes.html#CacheNodes.CurrentGen) and [guidance on selecting node types for Redis OSS](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/CacheNodes.SelectSize.html#CacheNodes.SelectSize.redis). See AWS documentation for information on [supported node types for Memcached](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/CacheNodes.SupportedTypes.html#CacheNodes.CurrentGen-Memcached) and [guidance on selecting node types for Memcached](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/CacheNodes.SelectSize.html#CacheNodes.SelectSize.Mem). For Memcached, changing this value will re-create the resource.
-
notificationTopicArn
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> notificationTopicArn()
- Returns:
- ARN of an SNS topic to send ElastiCache notifications to. Example: `arn:aws:sns:us-east-1:012345678999:my_sns_topic`.
-
numCacheNodes
public com.pulumi.core.Output<java.lang.Integer> numCacheNodes()
- Returns:
- The initial number of cache nodes that the cache cluster will have. For Redis, this value must be 1. For Memcached, this value must be between 1 and 40. If this number is reduced on subsequent runs, the highest numbered nodes will be removed.
-
outpostMode
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> outpostMode()
- Returns:
- Specify the outpost mode that will apply to the cache cluster creation. Valid values are `"single-outpost"` and `"cross-outpost"`, however AWS currently only supports `"single-outpost"` mode.
-
parameterGroupName
public com.pulumi.core.Output<java.lang.String> parameterGroupName()
- Returns:
- The name of the parameter group to associate with this cache cluster.
-
port
public com.pulumi.core.Output<java.lang.Integer> port()
- Returns:
- The port number on which each of the cache nodes will accept connections. For Memcached the default is 11211, and for Redis the default port is 6379. Cannot be provided with `replicationGroupId`. Changing this value will re-create the resource.
-
preferredAvailabilityZones
public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> preferredAvailabilityZones()
- Returns:
- List of the Availability Zones in which cache nodes are created. If you are creating your cluster in an Amazon VPC you can only locate nodes in Availability Zones that are associated with the subnets in the selected subnet group. The number of Availability Zones listed must equal the value of `numCacheNodes`. If you want all the nodes in the same Availability Zone, use `availabilityZone` instead, or repeat the Availability Zone multiple times in the list. Default: System chosen Availability Zones. Detecting drift of existing node availability zone is not currently supported. Updating this argument by itself to migrate existing node availability zones is not currently supported and will show a perpetual difference.
-
preferredOutpostArn
public com.pulumi.core.Output<java.lang.String> preferredOutpostArn()
- Returns:
- The outpost ARN in which the cache cluster will be created.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
replicationGroupId
public com.pulumi.core.Output<java.lang.String> replicationGroupId()
- Returns:
- ID of the replication group to which this cluster should belong. If this parameter is specified, the cluster is added to the specified replication group as a read replica; otherwise, the cluster is a standalone primary that is not part of any replication group.
-
securityGroupIds
public com.pulumi.core.Output<java.util.List<java.lang.String>> securityGroupIds()
- Returns:
- One or more VPC security groups associated with the cache cluster. Cannot be provided with `replication_group_id.`
-
snapshotArns
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> snapshotArns()
- Returns:
- Single-element string list containing an ARN of a Redis RDB snapshot file stored in Amazon S3. The object name cannot contain any commas. Changing `snapshotArns` forces a new resource.
-
snapshotName
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> snapshotName()
- Returns:
- Name of a snapshot from which to restore data into the new node group. Changing `snapshotName` forces a new resource.
-
snapshotRetentionLimit
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> snapshotRetentionLimit()
- Returns:
- Number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off. Please note that setting a `snapshotRetentionLimit` is not supported on cache.t1.micro cache nodes
-
snapshotWindow
public com.pulumi.core.Output<java.lang.String> snapshotWindow()
- Returns:
- Daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. Example: 05:00-09:00
-
subnetGroupName
public com.pulumi.core.Output<java.lang.String> subnetGroupName()
- Returns:
- Name of the subnet group to be used for the cache cluster. Changing this value will re-create the resource. Cannot be provided with `replication_group_id.`
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
transitEncryptionEnabled
public com.pulumi.core.Output<java.lang.Boolean> transitEncryptionEnabled()
- Returns:
- Enable encryption in-transit. Supported only with Memcached versions `1.6.12` and later, running in a VPC. For Redis or Valkey transit encryption, use `aws.elasticache.ReplicationGroup` instead. See the [ElastiCache in-transit encryption documentation](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/in-transit-encryption.html#in-transit-encryption-constraints) for more details.
-
get
public static Cluster get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ClusterState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-