0
votes

I need to deploy a Django app using PostgreSQL as the database on Google Cloud Platform. Since the app is only for my personal use, it has a minimal server load.

I tried a solution by deploying my app on an F1 App Engine standard environment(us-central1 region) and ran a PostgreSQL instance on an f1-small compute engine(us-central1 region). Both these are provided in GCP free tier in the us-central1 region. But it seems a VPC serverless connector is needed for app engine standard to access Postgres on compute engine on internal IP address.(which is billed as 2 e-2 micro instances).

Is there a better way of deploying it on GCP or connecting App engine standard with compute engine private IP, which incurs lesser cost?

1
Please check this - cloud.google.com/python/djangoMahboob

1 Answers

1
votes

Your choice will likely depend on what your app needs to do.

  • Use Cloud Run, which has a free tier, which you'll need to containerize your application, but this isn't too hard. You can then connect to your database running on Compute Engine using its IP address. I would recommend setting your max instances to ensure your costs stay low since it sounds like that is important to you. This looks doable by either public IP or using the VPC serverless connector (example).
  • Consider using CloudSQL for PostGreSQL and connecting to that from App Engine standard environment. If you choose the smallest shared core option, your Cloud SQL costs will likely be under $8 USD/month based on the pricing table.
  • Is your traffic level or memory load low enough that you might just run a webserver on your same Compute Engine instance? I've had challenges doing this myself with having enough memory for both app and database to run, but you might have better luck.