Create an AWS RDS database

05 Jan 2024 in TIL

I've been using RDS to provide throwaway databases for testing and wanted to work from the CLI to speed things up. The aws rds incantations were hard to find at times, so here they are for posterity.

Create a publicly accessible Postgres database:

bash
aws rds create-db-instance --db-instance-identifier demo-db --db-instance-class db.t3.micro --allocated-storage 50 --engine postgres --publicly-accessible --master-username postgres --master-user-password YOUR_PASSWORD

Show the database status and connection details:

bash
aws rds describe-db-instances | jq '.DBInstances[] | select(.DBInstanceIdentifier == "demo-db") | .DBInstanceStatus,.Endpoint'

Delete the database:

bash
aws rds delete-db-instance --db-instance-identifier demo-db --skip-final-snapshot