‫So we know that ODB
‫can be used to store data, but it can also
‫be used to store the session state, as a cache.
‫And so this is something that your web application can use.
‫And therefore, they can retrieve
‫or store the session states on demand.
‫And share the user login, for example,
‫across all your backend web applications.
‫So this is very common use case for DynamoDB.
‫But, this is something we've seen as well for ElastiCache.
‫So ElastiCache and DynamoDB achieve the same purpose.
‫So the question you may ask yourself is
‫what is the difference of using DynamoDB
‫or ElastiCache to store the session states?
‫Well, ElastiCache is going to be fully in memory,
‫and DynamoDB is going to be serverless.
‫And both are going to be key/value stores.
‫So if the exam is saying, okay we need
‫a session state store, that's going to be
‫in memory, it probably means ElastiCache.
‫And if it talks about automatic scaling and so on,
‫then DynamoDB is probably the right way.
‫So this is something you have to look for in the exam.
‫Another way you can store the session states
‫would be on disk.
‫And you need to share that disc across many EC2 instances.
‫So EFS could be a great choice.
‫So EFS must be attached
‫to your EC2 instances as a network drive.
‫And this could work versus DynamoDB.
‫But so EFS is a file system
‫and then DynamoDB is a database.
‫So here is the difference.
‫So you may say okay, you said EFS was for storage,
‫so what about my EBS volume and my EC2 instance store?
‫So yes this is storage, but it can only
‫be used for local caching, not shared caching.
‫Because your EBS drives and your instance store
‫are attached to only one EC2 instance.
‫So very important, this can be used
‫for caching a local dataset,
‫but not for sharing it across many instances.
‫And then finally, what about S3?
‫S3 could be used for session states,
‫yes, but it has a higher latency.
‫It's meant for big files, not for small objects.
‫So S3 as a station state cache is not a great tool.
‫So really, the best two are going to be
‫or best three is DynamoDB, ElastiCache, and EFS.
‫But preferably DynamoDB and ElastiCache.
‫And it's all about to figure out
‫if you want something in memory
‫or something that's going to be more serverless
‫and with automatic scaling.
‫Okay, that's it.
‫I will see you in the next lecture.