Skip to main content

Amazon ElastiCache for Redis

To get the votes from the voting app to the worker application, a Redis cache is used. The docker-compose exmaples all use a Redis container to do this job. However, when you migrate to the cloud, you should rely on hosted services when possible. For Redis AWS provides the Amazon ElastiCache for Redis.

In order to create the Redis cache, we again have split the code into two pieces:

One special resource that you will find in the modules, is the aws_ssm_parameter resource. This resource stores a value in the AWS Systems Manager Parameter Store. By using this, we can provide the connection string, so that the services that need that information can retrieve it. The following code snippet shows you how you can store a value in the parameter store:

infrastructure-modules/data-stores/redis/main.tf
loading...