Cloud Computing 基础
理解 cloud service models, providers, and benefits 的 cloud infrastructure.
你将学到
- 什么 cloud computing 是 and 为什么它 更改一切
- Service models: IaaS, PaaS, and SaaS
- Major cloud providers and 它们的 strengths
- 键 cloud 概念: 区域, availability 区域, scaling
概念讲解
什么是云计算?
Cloud computing means renting computing resources — servers, storage, databases, networking — from a provider over the internet, instead of buying and maintaining your own hardware. You pay for what you use, scale up or down instantly, and let the provider handle hardware maintenance, power, and cooling. This model has transformed how software is built and deployed, making it possible for a small team to run global-scale applications.
Service Models
There are three main service models. IaaS (Infrastructure as a Service) gives you virtual machines and networking — you manage the OS and everything above. PaaS (Platform as a Service) gives you a managed runtime — you deploy code and the provider handles servers, OS, and scaling. SaaS (Software as a Service) gives you a finished application — you just use it. Most teams use a mix: IaaS for custom needs, PaaS for speed, and SaaS for utilities.
Major Providers
Amazon Web Services (AWS) is the largest and most comprehensive provider, with over 200 services. Microsoft Azure integrates deeply with the Microsoft ecosystem and is strong in enterprise. Google Cloud Platform (GCP) excels in data, machine learning, and Kubernetes. Cloudflare specializes in edge computing, CDN, and security. Choosing a provider depends on your needs, existing stack, and team expertise.
Key Concepts
Cloud resources are organized into regions (geographic areas like us-east-1) and availability zones (isolated data centers within a region). Deploying across multiple zones provides high availability — if one data center fails, others keep running. Auto-scaling automatically adds or removes instances based on load. Elasticity — the ability to scale up and down on demand — is the defining characteristic of cloud computing.
Cloud Cost Management
Cloud pricing is pay-as-you-go, but costs can spiral quickly without governance. Use auto-scaling to match capacity to demand. Choose the right instance types — don't use a large server for a small workload. Use spot instances for batch jobs that can tolerate interruption. Set up billing alerts to catch unexpected charges. Tag resources with project and environment for cost attribution. Review your bill monthly and terminate unused resources. Cloud cost optimization is an ongoing discipline, not a one-time setup.
示例代码
# Install and configure the AWS CLI
pip install awscli
aws configure
# (prompts for Access Key, Secret Key, region, output format)
# List available regions and your resources
aws ec2 describe-regions --query 'Regions[].RegionName' --output table
aws s3 ls # list S3 buckets
aws ec2 describe-instances --query \
'Reservations[].Instances[].InstanceId' --output table
# Cloudflare CLI (Wrangler) for edge functions
npm install -g wrangler
wrangler whoami # check authentication
wrangler deploy # deploy a Worker to the edge
AWS CLI and Cloudflare Wrangler 是主要 command-行 tools for managing cloud resources. 它们 let 你 script infrastructure 不使用 using web consoles.
动手试一试
- DNS Lookup
查询 DNS 记录 for cloud services.
- My IP 地址
检查你的 IP for cloud security 分组.
- HTTP 请求 Tester
测试 API 端点 deployed 到 cloud.
常见错误
错误写法
选择 cloud provider 之前理解需求
正确做法
Evaluate 你的需要首先: budget, compliance, existing stack, team skills. 每个 provider 有不同 strengths. Don't 只是默认到 biggest — simplest option 那个 meets 你的需要是 经常 best.
错误写法
Deploying 到单个 availability 区域
正确做法
部署跨越 at 最少 two availability 区域 for 高 availability. 单个区域是 单个点 的失败 — 如果那个数据中心 goes 下, 你的 application goes 下.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。