Amazon Relational Database Service (Amazon RDS)
To get the votes from the worker application to the result app, a PostgreSQL
database is used. The docker-compose exmaples all use a PostgreSQL container
to do this job. However, when you migrate to the cloud, you should rely on
hosted services when possible. For PostgreSQL AWS provides the Amazon RDS for
PostgreSQL.
In order to create the PostgreSQL database, we again have split the code into two pieces:
As you can see, the module itself is generic. Meaning, you are not bound to just PostgreSQL. This means, you can decide on your own, whether you want to have a generic module or whether you want to have specific engine and even version modules. For example, if you want to restrict your company to use the same DB and version, you can provide one specific module with all the values hardcoded.
As in the redis module, we also use here the
aws_ssm_parameter
resource to store the connection information. 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:
loading...