welcome to part one of using AWS ElasticCache Redis in this video we're 2
going to go through the ElasticCache service and look at some of the features 3
of it and where we would actually use it the common use cases for ElasticCache 4
and we'll also look at getting some hands-on experience in creating an 5
ElasticCache cluster using the AWS console and then later on look at connecting to 6
that ElasticCache Redis engine to read and write information to in-memory cache 7
so ElasticCache it provides scalable in-memory cache so that is different to 8
RDS or DynamoDB which is data that will be persisted for a significant amount of 9
time, basically for as long as you want it to be so ElasticCache different 10
in that is designed for short-term storage of information and that 11
information to be accessed very quickly it currently supports the memcached and 12
Redis open source engines now the common use cases for ElastiCache would be to 13
first of all to reduce load on your databases so for example you might have 14
a dynamo DB database and you want to reduce the first of all the latency on 15
on that database so speed up your application you also want to reduce the 16
amount of reads and writes that database to reduce your cost and again you reduce 17
that load on that on that database and the way you would do that is that just 18
the same as in dynamo DB you would have storage of keys and objects of keys the 19
same you can do with with for example lesser cash Redis what we're going to be 20
using in this lab and that that will enable you to have high-speed access to 21
that data which will be in memory and you can put an expiry time on that data 22
so that so it it doesn't cost you significantly 23
then once you've finished using it the short-term it goes back it will be then 24
accessed into into that long-term dynamodb storage another very good use 25
case is to manage application session state so what we mean by that is if you 26
have a look at the diagram there on the right hand side we can see that we've 27
got a user which can he or she is connected in through an elastic load 28
balancer and will be connected to one of four ec2 instances so in this situation 29
the person is connected into the first ec2 server and they might be on a game 30
that has high score data they might be fling at some user profile data in a 31
forum or whatever so that's temporary session state storage that we want to 32
maintain but we don't want to maintain forever but we want to maintain that in 33
the short-term so what happens for example if that ec2 instance falls over 34
or the ec2 instance is part of an auto scaling group a group that scales down 35
and all of a sudden that user is taken from that first ec2 instance and then 36
they're rerouted into the second ec2 instance all of a sudden that user has 37
lost that information that what that would have it might be a high score of a 38
game it might be a form data that has been lost so that creates a lot of 39
problems for there or creates a lot of frustration for an end user and doesn't 40
provide a very good user experience so we can actually manage that session 41
state when we've got auto-scaling instances behind a elastic load balancer 42
or auto scaling groups behind an elastic load balancer and that will make sure 43
that when that back-end scaling is going on that the user won't be won't have a 44
bad experience from that so the first thing we need to do is to create a 45
security group for our our Redis cluster and that security group needs to be set 46
up so that it can allow our web servers to communicate with that Redis cluster 47
so the easiest way to do that is here I've 48
just going through and created a security group I won't go through how to 49
create a super new security group by this stage of the course you know how to 50
do that I'll just be boring you to death by going through the process here so 51
mainly what we've got here is a custom tcp rule that is on the port range of 52
six three seven nine which will be the port range for your ElasticCache 53
will be the port for your ElasticCache Redis cluster and the source is going to be 54
the webserver security group there so we're just allowing inbound on that and 55
the same on the outbound we're going to allow okay so we're going to allow 56
everything destination all on the outbound and so that's what we need to 57
do that the the details of that are in the in the lab notes for this video so 58
just make sure that you set up that security group first that Redis SG 59
security group okay so just jumping into the ElasticCache console we can see 60
here but we've got no clusters created yet so we just have the introduction 61
screen so before we create an ElasticCache cluster we need to have a cache subnet 62
group to launch that into so we click on here on the left hand side before we 63
click on getting started we click on cache subnet groups and we click on 64
create cache subnet group and so I've already created one here and I won't go 65
through the process again it's all detailed in the lab notes so I've just 66
got here is that it's in US East 1 and that's its details there so we've 67
created that that subnet group for our cache and then we can use that to launch 68
into a little launch our cache cluster into that so again the the details on 69
how to do that are very very straightforward I won't go into that and 70
it's detailed in the lab notes so just going back to the ElasticCache dashboard 71
okay so now we click on get started now and we select our Redis not memcache so 72
we collected Redis and click Next okay so we won't enable replication here 73
we'll leave that off to keep it simple but in a real application you would 74
probably look at multi a-z so we'll leave that off there for now and then 75
we'll give our cluster a name okay so by default it comes up with a large 76
instance so for a lab we don't want that we don't want to get a big bill at the 77
end of the month so we'll jump down to t2 micro which seems a little bit more 78
suitable for us we leave s3 location of our Redis RDB file we'll leave that 79
empty so click on next okay so this is where we're going to select our case 80
subnet group so there it is in and our available available available ities I 81
will leave that with no preference that's fine and our security group so we 82
need to select our Redis SG security group that we created previously in the 83
VPC console so no preference for maintenance window will disable any SNS 84
notifications will click on next and then we have a review of what we've got 85
there so we'll launch that case cluster now okay it's currently being created we 86
close out of this and we can see where we're currently being created so that's 87
coming along nicely so we'll just leave it there for now for the first part of 88
our ElasticCache Lab and in our next part we're going to look at connecting 89
into our ElastiCache Redis cluster and read and write data to that and and see 90
how that works and see how we can use some of these or Redis commands to get 91
information in and out of our cluster so I'll see you in part two