We launched Amazon ElastiCache about two years ago, and have steadily added features ever since. In the last two years we have added auto discovery, additional cache node types, and reserved cache nodes. We've reduced prices several times and we have added support for additional AWS Regions and VPC.
Today we are taking a big leap forward by adding support for a second in-memory caching engine. In addition to the existing support for Memcached, Amazon ElastiCache now supports the popular Redis key-value store. If you are already running Redis on-premises or on an EC2 instance, it should be very easy for you to upgrade to ElastiCache, while gaining the benefits of a fully managed service that is easy to launch, monitor, scale, and maintain.
Like its cousin Memcached, Redis is a key-value store. In short, you provide Redis with a key and a value to store data. Later, you provide the key and Redis returns the data. Redis builds on this model by giving you the ability to store structured data using atomic operations. This flexibility can make Redis a better match for your application's own data structures and can often simplify the cache management layer of your application. Redis supports the following data types:
- Strings that can be up to 512 Megabytes in length.
- Lists of strings, sorted by insertion order.
- Sets, unordered collections of strings.
- Hashes, maps between string fields and string values.
- Sorted Sets, collections of non-repeating strings, each ranked by an associated score.
Redis also supports atomic, high-level operations on items of each type. For example, you can push new elements on to the head or tail of a List, use strings as incrementing or decrementing atomic counters, add members to sets, intersect or union two sets to form a new set, manipulate hashes and hash fields, and much more.
Any key can have an associated Time To Live (TTL), after which the key and the value(s) associated with it will be removed. This feature allows you to fine-tune the caching model to store enough data to keep your application efficient and responsive, without consuming a disproportionately high amount of memory in the cache node.Redis supports the Lua programming language. You can invoke Lua scripts from your client application; these scripts can in turn invoke other Redis operations and have access to the stored keys and data.
Getting Started With Redis
AWS CloudFormation provides an easy way to create and manage a collection of AWS resources, provisioning and updating them in an orderly and predictable fashion. You can launch a Redis cluster within minutes using a new CloudFormation template which provisions a Redis cluster and a PHP application to connect to the cluster. Click to launch the stack now (the usual AWS charges apply), or download the sample ElastiCache Redis template and use it later.
You can launch a Redis cluster from the AWS Management Console. Start by switching to the ElastiCache tab and clicking this button:
Then work your way through the Launch Cache Cluster Wizard. Choose "redis" for your Engine on the first page:
If you have an existing on-premises installation of Redis, you can create a snapshot of your cache (an RDB file), upload it to an Amazon S3 bucket, and use it to preload your ElastiCache node running Redis. In the future, we expect to give you the ability to create similar snapshots of your own cache nodes.
You can choose any one of the following nine cache node types:
You can choose a Cache Security Group and a Cache Parameter Group on the second page of the wizard. You can also choose an appropriate Maintenance Window. The default Parameter Group for Redis gives you control of over thirty parameters:
After your Redis Cache Cluster is up and running, you can easily create a replication group and add nodes to it in order to increase the read throughput of the cluster:
Here are a few things to keep in mind as you start to plan your implementation of Amazon ElastiCache for Redis:
- We currently support version 2.6.13 of Redis.
- As I mentioned above, you can use an RDB file from an on-premises installation of Redis to preload your ElastiCache node. This RDB file must originate from a version of Redis that is compatible with the supported version.
- An ElastiCache for Redis replication group encapsulates the primary and read replica clusters for a Redis installation. A replication group will have one primary cluster and zero or many read replica clusters. All nodes within a replication group (and therefore within a cluster) will be of the same node type and will use the same Parameter Group and Security Group settings.
- You can create a read replica in another Availability Zone to increase availability. If the primary node fails, Amazon ElastiCache will replace it, preloaded with the contents of a read replica. It will also redirect the node's existing DNS name to point to the new node. You can create up to five read replicas for a given primary node. You can also promote a read replica to become a primary at any time.
- For persistence you can enable an AOF (Append Only File) log on the local disk of the ElastiCache node. If the log file is present when a node is restarted, ElastiCache will preload it. If you need more control over persistence, you can attach a Redis node that's running on an EC2 instance to an ElastiCache primary and enable the Redis RDB snapshot and/or AOF logs on the EC2 instance.
Learning About Redis
If you are new to the Redis programming and storage model, you may want to start out with the interactive tutorial. After you have mastered the basics, download a Redis client for the language and environment of your choice, then add sophisticated caching to your application.
We will be hosting a Redis webinar on September 26th to tell you more about this product. Space is limited so sign up now.
You can launch Redis cluster nodes today in all public AWS Regions. If you are new to Amazon ElastiCache, you can get started with Amazon ElastiCache for Redis as part of the AWS Free Usage Tier. As part of this tier, you can use 750 hours of ElastiCache for Redis on a micro node for one year.