Configure a Custom Domain for a Google Cloud Run Service
📖 Scenario: You have deployed a web application on Google Cloud Run. Now, you want to make it accessible through your own custom domain instead of the default Cloud Run URL.
🎯 Goal: Set up a custom domain mapping for your Cloud Run service to make your app accessible via www.example.com.
📋 What You'll Learn
Create a dictionary called
domain_mapping with keys domain and service and values 'www.example.com' and 'my-cloud-run-service' respectively.Create a variable called
project_id and set it to 'my-gcp-project'.Write a function called
create_domain_mapping that takes domain, service, and project_id as parameters and returns a dictionary with these keys and values.Add a final line that calls
create_domain_mapping with the values from domain_mapping and project_id and assigns the result to final_mapping.💡 Why This Matters
🌍 Real World
Custom domains make your cloud-hosted applications look professional and easier to remember for users.
💼 Career
Cloud engineers often configure custom domains to route traffic to cloud services securely and reliably.
Progress0 / 4 steps