A hands-on lab in fifteen slides, in the console and the CLI: rebuild the project's VPC and a client instance reached through Session Manager; create the database's security group and DB subnet group; create project-db, PostgreSQL, Multi-AZ, in the private subnets; store its credentials in Secrets Manager and connect with psql; time a reboot with failover with a loop of connections and read its events; add a read replica, read from it and see it refuse a write; then clean up.
The slides
The tool is a hands-on lab in fifteen slides, one step each, with the steps to follow beside a terminal and a picture of
the VPC's two AZs, the database's instances in them, and its security group, secret and endpoint.
- Introduction: what the lab makes.
- 1. Rebuild the VPC and a client
- Rebuild the VPC: the wizard, with session 4's ranges.
- Launch a client instance: no key pair, Session Manager, the PostgreSQL client.
- 2. The database's network
- Create the database's security group: 5432 from
project-web-sg. - Create the DB subnet group: the two private subnets.
- 3. The database
- Create the database:
project-db, PostgreSQL, Multi-AZ, db.t4g.micro. - Read the database from the CLI: the primary and secondary AZs, the endpoint.
- 4. The secret and a connection
- Store the credentials in Secrets Manager:
project/db. - Connect with psql: the secret read on the instance, a table of notes.
- 5. A failover, timed
- Start a loop of connections, reboot with failover, and read the failover's events.
- 6. A read replica
- Create a read replica, and read from the replica: a write refused, and the replica's lag.
- 7. Clean up
The buttons on the left and right edges move between slides. So do the arrow keys and a swipe.
The slides
RDS, Aurora and ElastiCache explain what it uses.
The secret
The lab keeps the database's password in a secret of its own, project/db, instead of letting RDS manage the master
password: RDS refuses read replicas of an instance whose master password it manages (on every engine but SQL Server
and Db2), and the lab adds one. The lesson explains both kinds.
The placeholders
The endpoints, the secret's ARN, the IDs and the password are placeholders, and the addresses are in the VPC's own
ranges. The outputs are written from the CLI's service model and PostgreSQL's messages, and the failover's timings are
illustrative: the lab has not yet been run in a real account.
Sources