Deploying a FastAPI app on Google Cloud Run

This is a very simple hello-world-walkthrough with FastAPI and Cloud Run. All code snippets described can also be found here. Initial Setup To play through this tutorial, I recommend creating a new project. You can do this in the console or with the Cloud SDK (recommended). You can find your billing account id here. Create your new project. export PROJECT_ID=<YOUR_UNIQUE_LOWER_CASE_PROJECT_ID> export BILLING_ACCOUNT_ID=<YOUR_BILLING_ACCOUNT_ID> export APP=myapp export PORT=1234 export REGION="europe-west3" export TAG="gcr.io/$PROJECT_ID/$APP" gcloud projects create $PROJECT_ID --name="My FastAPI App" # Set Default Project (all later commands will use it) gcloud config set project $PROJECT_ID # Add Billing Account (no free lunch^^) gcloud beta billing projects link $PROJECT_ID --billing-account=$BILLING_ACCOUNT_ID Enable the services you need....

March 27, 2022 ยท 3 min