How To Create MemCached Cluster in AWS

In this article we are going to cover How To Create MemCached Cluster in AWS.

In this guide, you’ll discover how to set up a Amazon ElastiCache MemCached. The best part is, all the steps we’ll cover can be done without incurring any extra costs because they’re eligible for the Free Tier.

Amazon ElastiCache

Amazon ElastiCache is a Caching-as-a-Service from Amazon Web Services. AWS simplifies setting up, managing, and scaling a distributed in-memory cache environment in the cloud. It provides a high-performance, scalable, and cost-effective caching solution. AWS removes the complexity associated with deploying and managing a distributed cache environment.

Amazon ElastiCache is a fully managed, in-memory data store service provided by Amazon Web Services (AWS). It is designed to enhance the performance and scalability of applications by providing a managed caching solution. ElastiCache supports two popular in-memory caching engines: Memcached and Redis. Here’s an overview of Amazon ElastiCache and its key features:

Key Features of Amazon ElastiCache:

  1. Managed Caching: ElastiCache handles the complex tasks of setting up, configuring, and managing caching infrastructure. It allows you to focus on your application’s logic without worrying about cache management.
  2. In-Memory Data Stores: ElastiCache supports two popular in-memory data store engines: Memcached: Memcached is a simple and fast caching engine that supports simple key-value data storage and retrieval. It is ideal for use cases where you need high-speed caching with minimal complexity. Redis: Redis is a highly versatile, open-source, in-memory data store that supports more advanced data structures, such as sorted sets, hashes, and lists. It is often used for caching, real-time analytics, and as a message broker.
  3. Scalability: ElastiCache allows you to easily scale your cache cluster vertically by selecting different instance types and horizontally by adding or removing cache nodes. This ensures your cache can handle increased workloads as your application grows.
  4. Automatic Failover: Redis clusters in ElastiCache can be configured with automatic failover. If a primary node fails, ElastiCache automatically promotes a read replica to the primary role, minimizing downtime.
  5. Backups and Restores: ElastiCache provides the ability to take manual snapshots of your cache clusters. You can use these snapshots to restore your cache data or clone cache clusters.

What is ElastiCache Memcached in AWS?

Memcached is one of the caching engines supported by ElastiCache. Memcached is a popular in-memory caching system used to improve the performance of web applications by storing frequently accessed data in memory. Until now we have discussed both the caching engines, but I may seem biased towards Redis.

Memcached is an open-source, high-performance, distributed in-memory caching system. It is commonly used to speed up data retrieval operations by caching frequently accessed data in memory, reducing the need to fetch data from slower data stores such as databases.

So the question is, if Redis is all powerful, then why doesn’t ElastiCache provide only Redis? There are few good reasons for using Memcached:

  • It is the simplest caching model.
  • It is helpful for people needing to run large nodes with multiple cores or threads.
  • It offers the ability to scale out/in, adding and removing nodes on-demand.
  • It handles partitioning data across multiple shards.

Prerequisites

Before you begin, you should have the following prerequisites in place:

  • You’ll need an Amazon Web Services (AWS) account. If you don’t have one, you can sign up for a free AWS account.
  • Basic knowledge of AWS services and concepts.

Create MemCached Cluster in AWS

  • Sign in to the AWS Console:
    • Open a new web browser window, and go to the AWS Management Console. In the console, type Elasticache in the search bar and choose Elasticache under Services to access the Amazon Elasticache console. This way, you can keep this guide open while working in the AWS console. Just remember, all of this won’t cost you anything extra since it’s eligible for the Free Tier.
elastic 1
  • At the top-right corner of the Amazon Elasticache console, choose the Region where you want to create your Elasticache. Currently I’m using Region SingaporeNote: AWS Cloud resources are housed in highly available data center facilities in different areas of the world. You have the ability to choose which Region to host your Amazon Elasticache activity in.
  • Click on Get Started, choose Create Cluster. Choose the “Memcached Cluster” option as the engine for your cache cluster.
create 1
  • Creation Method:
    • You now have to select the database engine version, and Configuration. For this tutorial, choose the Easy create methodSelect the default Demo as Configuration and engine version is default (1.6.17).
method
  • Cluster Info:
    • Provide a Name for your cache cluster in this guide I’m using “Demo-meme” and Descriptive default (it is optional).
    • Node type: The type of instance you want to use for your cache nodes (cache.t4g.micro) this setting is default.
cluster info
  • Connectivity:
    • Network Type: Stick with the default choice, which is IPv4. It’s the standard way computers talk to each other over the internet. Amazon Elasticache supports both IPv4 & IPv6.
    • Virtual Private Cloud (VPC): Choose “Default VPC.” This helps organize your resources in a secure and controlled network environment.
    • DB Subnet Group: Go with the default subnet group. It helps manage where your data is stored securely. If you want create your custom subnet group you can also create here.
    • Database Port: Keep it at the default value, which is 11211. It’s the channel through which your database communicates with other services.
connection
  • View default settings and Tag, Leave this section default as it is.
  • And in the end, Click on Create to initiate the creation of your Memcached cache cluster..
choose
  • After clicking “Create,” ElastiCache will begin provisioning your cache cluster. This process may take a few minutes.
  • Monitor the status of your cache cluster in the ElastiCache dashboard. Once the status changes to “Available,” your Memcached cache cluster is ready to use.
  • To access your Memcached cache cluster, you’ll need the Endpoint information. You can find this information in the ElastiCache dashboard under the “Nodes” tab for your cache cluster.
creation
  • After Creating an Amazon Elasticache Memcached, Create a Ubuntu EC2 Machine with simple configuration and launch it.

We have covered How To Create MemCached Cluster in AWS.

Connect Memcached Cluster on Ubuntu

  • After launcing the EC2 Instance, run below command
sudo apt update
sudo apt update
sudo apt update.png1
  • Now connect to a Amazon Elasticache Memcached, Here we using below command to connect. Also we substitute the DNS name (Endpoint, use your endpoint).
telnet <<endpoint memcached>> 
telnet
  • After run the command we can see this as result
result 1
  • So, we successfully connect with our Amazon Elasticache Memcached.

Conclusion:

In this article, we have learned How To Create MemCached Cluster in AWS | how to create a Memcached cache with Amazon ElastiCache. By following the steps here, you can set up a fully managed Memcached cache cluster to improve the performance and scalability of your applications. AWS provides an easy-to-use platform for managing caching infrastructure, allowing you to focus on building great software without worrying about the underlying infrastructure.

Related Articles:

How to Create MariaDB RDS in AWS [2 Steps]

Reference:

ElastiCache for Memcached in AWS official page

About Sohail Behlim

Hey, I am Sohail Behlim, I am an aspiring DevOps and Cloud enthusiast who is eager to embark on a journey into the world of DevOps and Cloud. With a strong passion for technology and a keen interest in DevOps and Cloud based solutions, I am driven to learn and contribute to the ever-evolving field of DevOps and Cloud.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link