hackoregon / civic-devops

Master collection point for issues, procedures, and code to manage the HackOregon Civic platform
MIT License
11 stars 4 forks source link

Automate the creation/lifecycle management of RDS database instances #232

Open MikeTheCanuck opened 5 years ago

MikeTheCanuck commented 5 years ago

Summary

Integrate the manually-created 2019 RDS database instances into our CloudFormation infrastructure-as-code.

Tasks

Definition of Done

MikeTheCanuck commented 5 years ago

Transportation-2019-staging database instance has been manually configured according to #229

MikeTheCanuck commented 5 years ago

Housing-2019-staging database instance has been manually configured according to #230

MikeTheCanuck commented 5 years ago

Some clues where to find compatible CF YAML templates - I noticed a reference in the old README.md in our hackoregon-aws-infrastructure repo to /infrastructure/rds.yaml, which strongly implies that at least as of March 5, 2017 (when we originally forked from the AWS Labs repo), there was a (semi?) working RDS deployment template that fit into this CF architecture.

So while that file is now gone from the originating repo, I notice 800+ forks from that repo, and found a few promising leads in the forked projects: https://github.com/BrianHGrant/ecs-refarch-cloudformation/blob/master/infrastructure/rds.yaml https://github.com/jnorback/ecs-refarch-cloudformation/blob/ECSandUpv1/db/postgresdb.yaml

MikeTheCanuck commented 4 years ago

Nearly all the CloudFormation code has been integrated, up to the need for SSM parameters to be integrated at runtime.

This article appears to have the key to constructing SSM parameter references: https://aws.amazon.com/blogs/mt/using-aws-systems-manager-parameter-store-secure-string-parameters-in-aws-cloudformation-templates/

The only thing we require in addition is to perform a Join operation or the like to insert a specific Project Name into the parameter name in that {{resolve:... statement.

MikeTheCanuck commented 4 years ago

Validation testing done today:

All clear. Happy to see that RDS upgrades like this doesn't brick the underlying data.