In this blog post , We will see how to setup Memcached cluster in AWS using AWS console.
In my previous blog post , I have explained in detail on how we can setup ElastiCache Redis cluster , Check here.
What is ElastiCache?
Amazon ElastiCache is a web service which is easy to setup , manage and scale a distributed in-memory data source or caching software in the cloud.
It provides Scalable , High performance and cost effective caching solution in the Cloud.
Elasticache works with the following engines:
These caching solutions can be easily integrated with the application to improve the performance of the applications.All it needs is the hostname of the Elasticache nodes and the port they are running.
Features of Memcached
- Automatic discovery of the nodes within a cluster enabled for automatic discovery , So that there wont be any manual intervention required in the application.
- Flexible availability zone placements of nodes and cluster.
- Automatic detection and recovery from cache node failures.
- Can be easily integrated with Cloudwatch , EC2 , SNS and CLoudtrail.
Launching Memcached Cluster
To create memcached cluster , Login to memcached console.
In the Navigation pane , Choose Subnet Groups
We have to create the subnets group , where the memcached cluster will be launched.
The Subnet groups should comprise of private subnets only.As The cluster will be used only for applications within the VPC.
Click Create Subnet Group
Provide a name for the subnet group and then Choose the VPC where the cluster should be launched.
For Availability Zone , Choose the Zone and the respective subnet and Click Add.
Minimum of 2 private subnet from 2 Availability zone should be added.
And Click Create
To know more about creating VPC with Public & Private subnets , Check here.
The subnet group required for launching the memcached cluster is created.
In the navigation pane , Choose Memcached , Click Create
For Cluster engine , Choose Memcached
For Memcached settings , Provide a name for the memcached cluster.
For Engine version compatibility , Select the version of memcached cluster to be launched.If there is no version constraints , Use the default engine version.
Lets use the default port : 11211 , If you want to run the cluster on the specific port , mention it there.
Use the default parameter group.This can be changed later as per the application requirement.
Select the Node type for the cluster nodes and the Number of nodes to be launched within the cluster.
For Advanced Memcached settings,
Select the subnet group we have created earlier.
For the nodes within the cluster to be placed across the availability zones , Choose your preferred availability zones.
Its mandatory to place the read replica in the availability zone different from the availability zone of the primary node , Which will result in Improved fault tolerance.
For Maintenance ,
If No preference , Elasticache chooses a time and a day of the week for the maintenance.
Specify maintenance window , If you prefer to Choose the time and day of the week for the cluster’s maintenance window.
Enable or disable notifications using SNS If required ,
and click Create
It should launch the Memcached cluster.
Once the Status of the Cluster becomes Available.
You can find the Cluster Configuration Endpoint , Which can be used in the application with the port you have specified while configuring the memcached cluster.
From the EC2 Instance , To access the Cluster configuration endpoint of the Memcached cluster , We need to allow the IP Address of EC2 instance in the Security group of the Memcached cluster for the port we configured.
For all the EC2 instances that will be launched later within the VPC to access the Memcached configuration endpoint , Allow the CIDR of the VPC in the memcached security port for the port 11211.
We have successfully deployed the Memcached cluster using AWS console , which will help us to improve the performance of the applications.
Hope you find it helpful , Please do check out my other articles.