UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

261 lines • 13.1 kB
"use strict"; // *** 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, Object.assign(Object.assign({}, 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 ? state.applyImmediately : undefined; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["autoMinorVersionUpgrade"] = state ? state.autoMinorVersionUpgrade : undefined; resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined; resourceInputs["azMode"] = state ? state.azMode : undefined; resourceInputs["cacheNodes"] = state ? state.cacheNodes : undefined; resourceInputs["clusterAddress"] = state ? state.clusterAddress : undefined; resourceInputs["clusterId"] = state ? state.clusterId : undefined; resourceInputs["configurationEndpoint"] = state ? state.configurationEndpoint : undefined; resourceInputs["engine"] = state ? state.engine : undefined; resourceInputs["engineVersion"] = state ? state.engineVersion : undefined; resourceInputs["engineVersionActual"] = state ? state.engineVersionActual : undefined; resourceInputs["finalSnapshotIdentifier"] = state ? state.finalSnapshotIdentifier : undefined; resourceInputs["ipDiscovery"] = state ? state.ipDiscovery : undefined; resourceInputs["logDeliveryConfigurations"] = state ? state.logDeliveryConfigurations : undefined; resourceInputs["maintenanceWindow"] = state ? state.maintenanceWindow : undefined; resourceInputs["networkType"] = state ? state.networkType : undefined; resourceInputs["nodeType"] = state ? state.nodeType : undefined; resourceInputs["notificationTopicArn"] = state ? state.notificationTopicArn : undefined; resourceInputs["numCacheNodes"] = state ? state.numCacheNodes : undefined; resourceInputs["outpostMode"] = state ? state.outpostMode : undefined; resourceInputs["parameterGroupName"] = state ? state.parameterGroupName : undefined; resourceInputs["port"] = state ? state.port : undefined; resourceInputs["preferredAvailabilityZones"] = state ? state.preferredAvailabilityZones : undefined; resourceInputs["preferredOutpostArn"] = state ? state.preferredOutpostArn : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["replicationGroupId"] = state ? state.replicationGroupId : undefined; resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined; resourceInputs["snapshotArns"] = state ? state.snapshotArns : undefined; resourceInputs["snapshotName"] = state ? state.snapshotName : undefined; resourceInputs["snapshotRetentionLimit"] = state ? state.snapshotRetentionLimit : undefined; resourceInputs["snapshotWindow"] = state ? state.snapshotWindow : undefined; resourceInputs["subnetGroupName"] = state ? state.subnetGroupName : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["transitEncryptionEnabled"] = state ? state.transitEncryptionEnabled : undefined; } else { const args = argsOrState; resourceInputs["applyImmediately"] = args ? args.applyImmediately : undefined; resourceInputs["autoMinorVersionUpgrade"] = args ? args.autoMinorVersionUpgrade : undefined; resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined; resourceInputs["azMode"] = args ? args.azMode : undefined; resourceInputs["clusterId"] = args ? args.clusterId : undefined; resourceInputs["engine"] = args ? args.engine : undefined; resourceInputs["engineVersion"] = args ? args.engineVersion : undefined; resourceInputs["finalSnapshotIdentifier"] = args ? args.finalSnapshotIdentifier : undefined; resourceInputs["ipDiscovery"] = args ? args.ipDiscovery : undefined; resourceInputs["logDeliveryConfigurations"] = args ? args.logDeliveryConfigurations : undefined; resourceInputs["maintenanceWindow"] = args ? args.maintenanceWindow : undefined; resourceInputs["networkType"] = args ? args.networkType : undefined; resourceInputs["nodeType"] = args ? args.nodeType : undefined; resourceInputs["notificationTopicArn"] = args ? args.notificationTopicArn : undefined; resourceInputs["numCacheNodes"] = args ? args.numCacheNodes : undefined; resourceInputs["outpostMode"] = args ? args.outpostMode : undefined; resourceInputs["parameterGroupName"] = args ? args.parameterGroupName : undefined; resourceInputs["port"] = args ? args.port : undefined; resourceInputs["preferredAvailabilityZones"] = args ? args.preferredAvailabilityZones : undefined; resourceInputs["preferredOutpostArn"] = args ? args.preferredOutpostArn : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["replicationGroupId"] = args ? args.replicationGroupId : undefined; resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined; resourceInputs["snapshotArns"] = args ? args.snapshotArns : undefined; resourceInputs["snapshotName"] = args ? args.snapshotName : undefined; resourceInputs["snapshotRetentionLimit"] = args ? args.snapshotRetentionLimit : undefined; resourceInputs["snapshotWindow"] = args ? args.snapshotWindow : undefined; resourceInputs["subnetGroupName"] = args ? args.subnetGroupName : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["transitEncryptionEnabled"] = args ? args.transitEncryptionEnabled : undefined; 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