Google Cloud Endpoints with Google Cloud Run
Google Cloud Endpoints with Google Cloud Run
I will follow this tutorial.
gcr.io/cloudrun/hello
as a container image.Run the command:
gcloud beta run deploy SERVICE_NAME --image=gcr.io/endpoints-release/endpoints-runtime-serverless:1.30.0 --allow-unauthenticated --region=us-central1 --project=PROJECT_ID
replace SERVICE_NAME
and PROJECT_ID
. Take note of the hostname in the URL.
openapi-run.yaml.example
to openapi-run.yaml
.my.esp.host
to your ESP hostname. Don’t include the protocol identifier https://
.https://my.backend.service.url
to your URL of your backend service.Run the command:
gcloud endpoints services deploy openapi-run.yaml --project PROJECT_ID
replace PROJECT_ID
.
SERVICE_NAME
—set-env-vars ENDPOINTS_SERVICE_NAME=HOST
—region us-central1 —project PROJECT_ID
BACKEND_SERVICE
—member serviceAccount:PROJECT_NUMBER
-compute@developer.gserviceaccount.com —role roles/run.invoker —project PROJECT_ID
SERVICE_NAME
to ESP service name.HOST
to cloud endpoints host.PROJECT_ID
and PROJECT_NUMBER
.BACKEND_SERVICE
to your backend on Cloud Run.Run a command:
curl --request GET --header "content-type:application/json" "https://${ENDPOINTS_HOST}/hello"
replace ${ENDPOINTS_HOST}
to host value on endpoints configuration.