There is an administration tool in AWS called Systems Manager which allows us to perform admin tasks on many instances at once. It enables centralized management of resources. Here we use a feature of Systems Manager called Parameter Store. It is a key-value store where you can store strings and passwords.
We are going to use Parameter Store to store the Environment Variables to be passed to the WordPress containers in the ECS Tasks. This will ensure that passwords are stored securely. We can also manage all variables from one place. Parameter Store is region specific. When Fargate runs the WordPress container, it will pull the values from the Parameter Store. The ECS Task Execution Role will allow Fargate to access the Parameter Store.
Create the parameters for the container environment variables
Systems Manager > Parameter Store
WPSTACK_DB_HOST > Type: String > Value: wp-stack-aurora-serverless-db.cluster-c9wroj.ap-southeast-1.rds.amazonaws.com WPSTACK_DB_NAME > Type: String > Value: wpstack WPSTACK_DB_PASSWORD > Type: SecureString > Value: *** WPSTACK_DB_USER > Type: String > Value: wpuser