@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
261 lines • 11.8 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides 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 Valkey and 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
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.elasticache.Cluster("example", {
* clusterId: "cluster-example",
* engine: "memcached",
* nodeType: "cache.m4.large",
* numCacheNodes: 2,
* parameterGroupName: "default.memcached1.4",
* port: 11211,
* });
* ```
*
* ### Redis Instance
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.elasticache.Cluster("example", {
* clusterId: "cluster-example",
* engine: "redis",
* nodeType: "cache.m4.large",
* numCacheNodes: 1,
* parameterGroupName: "default.redis3.2",
* engineVersion: "3.2.10",
* port: 6379,
* });
* ```
*
* ### Redis Cluster Mode Disabled Read Replica Instance
*
* These inherit their settings from the replication group.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const replica = new aws.elasticache.Cluster("replica", {
* clusterId: "cluster-example",
* replicationGroupId: example.id,
* });
* ```
*
* ### Redis Log Delivery configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const test = new aws.elasticache.Cluster("test", {
* clusterId: "mycluster",
* engine: "redis",
* nodeType: "cache.t3.micro",
* numCacheNodes: 1,
* port: 6379,
* applyImmediately: true,
* logDeliveryConfigurations: [
* {
* destination: example.name,
* destinationType: "cloudwatch-logs",
* logFormat: "text",
* logType: "slow-log",
* },
* {
* destination: exampleAwsKinesisFirehoseDeliveryStream.name,
* destinationType: "kinesis-firehose",
* logFormat: "json",
* logType: "engine-log",
* },
* ],
* });
* ```
*
* ### Elasticache Cluster in Outpost
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.outposts.getOutposts({});
* const exampleGetOutpost = example.then(example => aws.outposts.getOutpost({
* id: example.ids?.[0],
* }));
* const exampleVpc = new aws.ec2.Vpc("example", {cidrBlock: "10.0.0.0/16"});
* const exampleSubnet = new aws.ec2.Subnet("example", {
* vpcId: exampleVpc.id,
* cidrBlock: "10.0.1.0/24",
* tags: {
* Name: "my-subnet",
* },
* });
* const exampleSubnetGroup = new aws.elasticache.SubnetGroup("example", {
* name: "my-cache-subnet",
* subnetIds: [exampleSubnet.id],
* });
* const exampleCluster = new aws.elasticache.Cluster("example", {
* clusterId: "cluster-example",
* outpostMode: "single-outpost",
* preferredOutpostArn: exampleGetOutpost.then(exampleGetOutpost => exampleGetOutpost.arn),
* engine: "memcached",
* nodeType: "cache.r5.large",
* numCacheNodes: 2,
* parameterGroupName: "default.memcached1.4",
* port: 11211,
* subnetGroupName: exampleSubnetGroup.name,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import ElastiCache Clusters using the `cluster_id`. For example:
*
* ```sh
* $ pulumi import aws:elasticache/cluster:Cluster my_cluster my_cluster
* ```
*/
class Cluster extends pulumi.CustomResource {
/**
* Get an existing Cluster resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Cluster(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Cluster. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Cluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["applyImmediately"] = state?.applyImmediately;
resourceInputs["arn"] = state?.arn;
resourceInputs["autoMinorVersionUpgrade"] = state?.autoMinorVersionUpgrade;
resourceInputs["availabilityZone"] = state?.availabilityZone;
resourceInputs["azMode"] = state?.azMode;
resourceInputs["cacheNodes"] = state?.cacheNodes;
resourceInputs["clusterAddress"] = state?.clusterAddress;
resourceInputs["clusterId"] = state?.clusterId;
resourceInputs["configurationEndpoint"] = state?.configurationEndpoint;
resourceInputs["engine"] = state?.engine;
resourceInputs["engineVersion"] = state?.engineVersion;
resourceInputs["engineVersionActual"] = state?.engineVersionActual;
resourceInputs["finalSnapshotIdentifier"] = state?.finalSnapshotIdentifier;
resourceInputs["ipDiscovery"] = state?.ipDiscovery;
resourceInputs["logDeliveryConfigurations"] = state?.logDeliveryConfigurations;
resourceInputs["maintenanceWindow"] = state?.maintenanceWindow;
resourceInputs["networkType"] = state?.networkType;
resourceInputs["nodeType"] = state?.nodeType;
resourceInputs["notificationTopicArn"] = state?.notificationTopicArn;
resourceInputs["numCacheNodes"] = state?.numCacheNodes;
resourceInputs["outpostMode"] = state?.outpostMode;
resourceInputs["parameterGroupName"] = state?.parameterGroupName;
resourceInputs["port"] = state?.port;
resourceInputs["preferredAvailabilityZones"] = state?.preferredAvailabilityZones;
resourceInputs["preferredOutpostArn"] = state?.preferredOutpostArn;
resourceInputs["region"] = state?.region;
resourceInputs["replicationGroupId"] = state?.replicationGroupId;
resourceInputs["securityGroupIds"] = state?.securityGroupIds;
resourceInputs["snapshotArns"] = state?.snapshotArns;
resourceInputs["snapshotName"] = state?.snapshotName;
resourceInputs["snapshotRetentionLimit"] = state?.snapshotRetentionLimit;
resourceInputs["snapshotWindow"] = state?.snapshotWindow;
resourceInputs["subnetGroupName"] = state?.subnetGroupName;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["transitEncryptionEnabled"] = state?.transitEncryptionEnabled;
}
else {
const args = argsOrState;
resourceInputs["applyImmediately"] = args?.applyImmediately;
resourceInputs["autoMinorVersionUpgrade"] = args?.autoMinorVersionUpgrade;
resourceInputs["availabilityZone"] = args?.availabilityZone;
resourceInputs["azMode"] = args?.azMode;
resourceInputs["clusterId"] = args?.clusterId;
resourceInputs["engine"] = args?.engine;
resourceInputs["engineVersion"] = args?.engineVersion;
resourceInputs["finalSnapshotIdentifier"] = args?.finalSnapshotIdentifier;
resourceInputs["ipDiscovery"] = args?.ipDiscovery;
resourceInputs["logDeliveryConfigurations"] = args?.logDeliveryConfigurations;
resourceInputs["maintenanceWindow"] = args?.maintenanceWindow;
resourceInputs["networkType"] = args?.networkType;
resourceInputs["nodeType"] = args?.nodeType;
resourceInputs["notificationTopicArn"] = args?.notificationTopicArn;
resourceInputs["numCacheNodes"] = args?.numCacheNodes;
resourceInputs["outpostMode"] = args?.outpostMode;
resourceInputs["parameterGroupName"] = args?.parameterGroupName;
resourceInputs["port"] = args?.port;
resourceInputs["preferredAvailabilityZones"] = args?.preferredAvailabilityZones;
resourceInputs["preferredOutpostArn"] = args?.preferredOutpostArn;
resourceInputs["region"] = args?.region;
resourceInputs["replicationGroupId"] = args?.replicationGroupId;
resourceInputs["securityGroupIds"] = args?.securityGroupIds;
resourceInputs["snapshotArns"] = args?.snapshotArns;
resourceInputs["snapshotName"] = args?.snapshotName;
resourceInputs["snapshotRetentionLimit"] = args?.snapshotRetentionLimit;
resourceInputs["snapshotWindow"] = args?.snapshotWindow;
resourceInputs["subnetGroupName"] = args?.subnetGroupName;
resourceInputs["tags"] = args?.tags;
resourceInputs["transitEncryptionEnabled"] = args?.transitEncryptionEnabled;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["cacheNodes"] = undefined /*out*/;
resourceInputs["clusterAddress"] = undefined /*out*/;
resourceInputs["configurationEndpoint"] = undefined /*out*/;
resourceInputs["engineVersionActual"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Cluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.Cluster = Cluster;
/** @internal */
Cluster.__pulumiType = 'aws:elasticache/cluster:Cluster';
//# sourceMappingURL=cluster.js.map