1 00:00:00,360 --> 00:00:01,450 So let's talk about some 2 00:00:01,450 --> 00:00:03,310 additional information you need to know, 3 00:00:03,310 --> 00:00:04,780 going into the exam for 4 00:00:04,780 --> 00:00:06,950 the Solutions Architects with ElastiCache. 5 00:00:06,950 --> 00:00:09,240 First of all, all the caches in ElastiCache 6 00:00:09,240 --> 00:00:11,280 do not support IAM authentication. 7 00:00:11,280 --> 00:00:13,410 The IAM policies, you will define on ElastiCache 8 00:00:13,410 --> 00:00:17,220 are only used for AWS API-level security. 9 00:00:17,220 --> 00:00:18,550 That means creating a cache, 10 00:00:18,550 --> 00:00:19,383 deleting the cache, 11 00:00:19,383 --> 00:00:20,216 that kind of stuff. 12 00:00:20,216 --> 00:00:24,080 But any operations within the cache is not using IAM. 13 00:00:24,080 --> 00:00:26,200 Now, if you want to authenticate your Redis, 14 00:00:26,200 --> 00:00:27,690 you can use Redis AUTH, 15 00:00:27,690 --> 00:00:29,900 and you can set a password/token 16 00:00:29,900 --> 00:00:31,340 when you create a Redis cluster. 17 00:00:31,340 --> 00:00:33,350 And this allows you to have a password 18 00:00:33,350 --> 00:00:34,720 when going into your cache. 19 00:00:34,720 --> 00:00:36,300 This is an extra level of security 20 00:00:36,300 --> 00:00:37,810 on top of security groups, 21 00:00:37,810 --> 00:00:39,270 that you can use for your cache. 22 00:00:39,270 --> 00:00:40,890 And you can support SSL, 23 00:00:40,890 --> 00:00:44,340 SSL security, for in flight encryption. 24 00:00:44,340 --> 00:00:45,173 Whereas, for Memcached, 25 00:00:45,173 --> 00:00:47,190 it supports SASL-based authentication, 26 00:00:47,190 --> 00:00:48,150 which is quite advanced. 27 00:00:48,150 --> 00:00:50,800 Sort of different kind of authentication mechanism. 28 00:00:50,800 --> 00:00:53,380 So if you look at the security of your cache, 29 00:00:53,380 --> 00:00:55,960 an EC2 instance will have it's own security group, 30 00:00:55,960 --> 00:00:57,100 which can access Redis 31 00:00:57,100 --> 00:00:58,210 for their own security group as well. 32 00:00:58,210 --> 00:01:00,490 So you can do security group level security 33 00:01:00,490 --> 00:01:01,910 using ElastiCache. 34 00:01:01,910 --> 00:01:03,330 And then for encryption in flight, 35 00:01:03,330 --> 00:01:04,900 you have SSL encryption. 36 00:01:04,900 --> 00:01:05,990 And for authentication, 37 00:01:05,990 --> 00:01:07,460 you can have Redis AUTH 38 00:01:07,460 --> 00:01:09,670 if you're using the Redis kind of cache 39 00:01:09,670 --> 00:01:10,503 in ElastiCache. 40 00:01:11,660 --> 00:01:13,360 Now there are three kinds of patterns 41 00:01:13,360 --> 00:01:15,200 for loading data into ElastiCache. 42 00:01:15,200 --> 00:01:17,190 The number one is Lazy Loading, 43 00:01:17,190 --> 00:01:18,820 where all the read data is cached 44 00:01:18,820 --> 00:01:21,070 and data can become stale in the cache. 45 00:01:21,070 --> 00:01:23,140 Write Through, which is to add or update data 46 00:01:23,140 --> 00:01:24,960 in the cache whenever it is written 47 00:01:24,960 --> 00:01:27,240 to the database where there is no stale data. 48 00:01:27,240 --> 00:01:29,239 And using ElastiCache as a Session Store 49 00:01:29,239 --> 00:01:30,910 that we saw before, 50 00:01:30,910 --> 00:01:32,170 and then we can expire a session 51 00:01:32,170 --> 00:01:34,560 using the Time To Live features. 52 00:01:34,560 --> 00:01:35,810 Now, caching is very hard 53 00:01:35,810 --> 00:01:37,060 and there's this very famous quote 54 00:01:37,060 --> 00:01:38,300 in computer science, 55 00:01:38,300 --> 00:01:41,050 That there are only two hard things in Computer Science: 56 00:01:41,050 --> 00:01:42,860 cache invalidation, and naming things. 57 00:01:42,860 --> 00:01:45,010 So caching is a very complicated topic 58 00:01:45,010 --> 00:01:47,110 and I gave you a very high level overview, 59 00:01:47,110 --> 00:01:51,100 but let's illustrate the Lazy Loading strategy here. 60 00:01:51,100 --> 00:01:54,353 So your application, if it has a cache hit in ElastiCache, 61 00:01:54,353 --> 00:01:55,890 gets the data from the cache, 62 00:01:55,890 --> 00:01:57,510 otherwise there's a cache miss, 63 00:01:57,510 --> 00:01:59,200 therefore you read from the database 64 00:01:59,200 --> 00:02:00,233 and you write to the cache. 65 00:02:00,233 --> 00:02:02,360 This is something we've seen from before, 66 00:02:02,360 --> 00:02:03,630 and it is called Lazy Loading 67 00:02:03,630 --> 00:02:05,960 because only when you don't have a cache hits, 68 00:02:05,960 --> 00:02:08,562 then you load the data into Amazon ElastiCache. 69 00:02:10,080 --> 00:02:13,270 So, now let's talk about the use cases for Redis, 70 00:02:13,270 --> 00:02:15,550 and there's one you need to know going into the exam. 71 00:02:15,550 --> 00:02:18,370 It is around creating a Gaming Leaderboard. 72 00:02:18,370 --> 00:02:19,400 So it is very complex. 73 00:02:19,400 --> 00:02:20,480 The idea is that you want to say, 74 00:02:20,480 --> 00:02:21,910 Who is number one, who is number two, 75 00:02:21,910 --> 00:02:23,930 who is number three at any moment in time, 76 00:02:23,930 --> 00:02:25,140 for your game. 77 00:02:25,140 --> 00:02:28,730 And so there is a feature in Redis called Sorted sets, 78 00:02:28,730 --> 00:02:32,240 which guarantees both uniqueness and element ordering. 79 00:02:32,240 --> 00:02:34,140 And each time an element is added 80 00:02:34,140 --> 00:02:35,980 it's going to be ranked in real time 81 00:02:35,980 --> 00:02:37,810 and then add it in the correct order. 82 00:02:37,810 --> 00:02:39,700 The idea is that if you have a Redis cluster, 83 00:02:39,700 --> 00:02:41,830 you can create a Real-time Leaderboard 84 00:02:41,830 --> 00:02:43,530 with a number one, number two, 85 00:02:43,530 --> 00:02:45,500 and number three player in real time. 86 00:02:45,500 --> 00:02:47,287 And all the Redis cache will have 87 00:02:47,287 --> 00:02:50,090 the same leaderboard available. 88 00:02:50,090 --> 00:02:51,360 That means that your clients 89 00:02:51,360 --> 00:02:54,910 when talking to your Amazon ElastiCache using Redis, 90 00:02:54,910 --> 00:02:56,260 they can have access to this leverage, 91 00:02:56,260 --> 00:02:57,350 Real-time leaderboard, 92 00:02:57,350 --> 00:03:00,330 and we don't need to program that feature application side. 93 00:03:00,330 --> 00:03:02,260 We can use, leverage, Redis, 94 00:03:02,260 --> 00:03:03,720 with the Sorted sets 95 00:03:03,720 --> 00:03:05,760 to get access to Real-time Leaderboard. 96 00:03:05,760 --> 00:03:06,810 And this is, yet again, 97 00:03:06,810 --> 00:03:08,340 something that can come up in the exam. 98 00:03:08,340 --> 00:03:10,080 Okay. So that's it for this lecture. 99 00:03:10,080 --> 00:03:10,990 I hope you liked it. 100 00:03:10,990 --> 00:03:12,940 And I will see you in the next lecture.