Cloud services are computing resources delivered over the internet, including storage, databases, networking, and compute power. You rent these instead of owning physical hardware.
Core terminology:
- Serverless: Code runs without managing servers (like Google Cloud Functions, AWS Lambda)
- Container: Packaged application with its dependencies
- API: Interface for applications to communicate
- Load balancer: Distributes traffic across multiple servers
- Auto-scaling: Automatically adjusts resources based on demand
Basic learning path:
- Start with one cloud provider (Google Cloud, AWS, or Azure)
- Learn basic services: compute, storage, databases
- Practice with serverless functions
- Explore containers and orchestration
- Study networking and security basics
Logging best practices:
Instead of print statements, use structured logging with different severity levels (DEBUG, INFO, WARNING, ERROR). This makes logs searchable and filterable in cloud environments.
Here's a Python example that works both locally and in Google Cloud Functions:
import logging
import json
from google.cloud import logging as cloud_logging
def setup_logging():
# For local development
if not hasattr(setup_logging, 'configured'):
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
setup_logging.configured = True
# For Google Cloud (automatically detects cloud environment)
try:
client = cloud_logging.Client()
client.setup_logging()
except Exception:
pass # Fall back to local logging
def main():
setup_logging()
logger = logging.getLogger(__name__)
logger.info("Program started")
logger.info("Data loaded")
# Structured logging with extra context
logger.info("Data processing progress", extra={
'processed': 12,
'total': 38,
'progress_percent': 31.6
})
try:
# Your code here
pass
except FileNotFoundError as e:
logger.error(f"File not found: {e}")
except Exception as e:
logger.exception("Unexpected error occurred")
# For Google Cloud Functions
def cloud_function_entry(request):
main()
return "Success"
if __name__ == "__main__":
main()
Key logging principles:
- Use appropriate log levels (INFO for normal flow, ERROR for problems)
- Include context in your messages
- Avoid logging sensitive data
- Use structured logging (JSON format) for better searchability
- Set up log aggregation in production
In Google Cloud, your logs automatically appear in Cloud Logging where you can filter, search, and set up alerts. This approach gives you console output locally and proper cloud logging in production without code changes.