

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: RDS: Relational Database Service
incomplete
2: Create a PostgreSQL Database
incomplete
3: Connect to Your Database
incomplete
4: Connect App to Database
incomplete
5: RDS Storage and IOPS
incomplete
6: RDS Backups
incomplete
7: Read Replicas
incomplete
8: Cleanup
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
We've seen that we can use psql from our EC2 instance to connect to the Postgres DB running in RDS. That's no small feat; a bunch of things had to be configured just right for it to work.
The good news is that it will take only one more small step to get the PatientPing app communicating with the database automatically. Instead of using psql manually, we'll set a DATABASE_URL environment variable that the Python app can read when it starts up!
The PatientPing app still can't connect to the Postgres database! Fix the problem by adding a .env file with DB connection info on the EC2 instance.
ssh patientping
cd ~/patientping-web
To keep things simple, make sure the app isn't running at this point.
nano .env
DATABASE_URL='postgresql://postgres:[email protected]:5432/patientping'
pwd # /home/ec2-user/patientping-web
cat .env # DATABASE_URL='postgresql://postgres:PASSWORD...'
uv run patientping.py
Keep the PatientPing app running in a separate terminal session while you run and submit the CLI tests.