Cloud Computing Fundamentals: IaaS, PaaS, SaaS, AWS, Azure, GCP & Serverless
This comprehensive guide covers cloud computing fundamentals, service models, and major cloud providers.
What is Cloud Computing?
Cloud computing is the on-demand delivery of IT resources over the Internet with pay-as-you-go pricing. Instead of buying, owning, and maintaining your own data centers and servers, you can access technology services, such as computing power, storage, and databases, on an as-needed basis from a cloud provider.
Cloud Service Models
IaaS (Infrastructure as a Service)
IaaS provides fundamental computing resources such as virtual machines, storage, and networking.
Examples:
- AWS EC2, S3, VPC
- Azure Virtual Machines, Blob Storage
- Google Compute Engine, Cloud Storage
Use Cases:
- Hosting websites and applications
- Data storage and backup
- Disaster recovery
- Big data processing
# Example: AWS EC2 instance configuration
Resources:
MyEC2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: t3.micro
ImageId: ami-0c55b159cbfafe1f0
KeyName: my-key-pair
PaaS (Platform as a Service)
PaaS provides a platform for developing, testing, delivering, and managing software applications.
Examples:
- AWS Elastic Beanstalk, Lambda
- Azure App Service, Functions
- Google App Engine, Cloud Functions
Use Cases:
- Web application development
- API development
- Mobile app backends
- Data processing pipelines
// Example: AWS Lambda function
exports.handler = async (event) => {
console.log('Event:', JSON.stringify(event, null, 2));
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
return response;
};
SaaS (Software as a Service)
SaaS provides ready-to-use software applications over the internet.
Examples:
- Google Workspace, Microsoft 365
- Salesforce, Slack
- Dropbox, Adobe Creative Cloud
Use Cases:
- Email and collaboration
- Customer relationship management
- Project management
- Document storage
Major Cloud Providers
Amazon Web Services (AWS)
AWS is the most comprehensive and broadly adopted cloud platform.
Key Services:
- Compute: EC2, Lambda, ECS, EKS
- Storage: S3, EBS, Glacier
- Database: RDS, DynamoDB, Aurora
- Networking: VPC, CloudFront, Route 53
- Security: IAM, KMS, GuardDuty
# Example: AWS SDK for Python (Boto3)
import boto3
# Create S3 client
s3 = boto3.client('s3')
# Upload file to S3
s3.upload_file(
'local-file.txt',
'my-bucket',
'remote-file.txt'
)
# List objects in bucket
response = s3.list_objects_v2(Bucket='my-bucket')
for obj in response['Contents']:
print(obj['Key'])
Microsoft Azure
Azure is Microsoft’s cloud computing platform, offering a wide range of services.
Key Services:
- Compute: Virtual Machines, App Service, Functions
- Storage: Blob Storage, Disk Storage, Archive
- Database: SQL Database, Cosmos DB, Database for MySQL/PostgreSQL
- Networking: Virtual Network, CDN, DNS
- Security: Azure AD, Key Vault, Security Center
// Example: Azure SDK for .NET
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
// Create blob client
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient("my-container");
// Upload blob
BlobClient blobClient = containerClient.GetBlobClient("my-blob");
await blobClient.UploadAsync("local-file.txt", true);
Google Cloud Platform (GCP)
GCP is Google’s suite of cloud computing services.
Key Services:
- Compute: Compute Engine, App Engine, Cloud Functions
- Storage: Cloud Storage, Persistent Disk, Archive
- Database: Cloud SQL, Firestore, BigQuery
- Networking: VPC, Cloud CDN, Cloud DNS
- Security: Cloud IAM, KMS, Security Command Center
// Example: Google Cloud SDK for Node.js
const {Storage} = require('@google-cloud/storage');
// Create storage client
const storage = new Storage();
const bucket = storage.bucket('my-bucket');
// Upload file
await bucket.upload('local-file.txt', {
destination: 'remote-file.txt'
});
// List files
const [files] = await bucket.getFiles();
files.forEach(file => {
console.log(file.name);
});
Serverless Computing
Serverless computing allows you to build and run applications without thinking about servers.
Benefits of Serverless
- No server management: No provisioning or maintaining servers
- Automatic scaling: Scales automatically based on demand
- Pay-per-use: Only pay for actual compute time
- Built-in availability and fault tolerance
Serverless Examples
AWS Lambda
import json
def lambda_handler(event, context):
# Process incoming event
name = event.get('name', 'World')
# Return response
return {
'statusCode': 200,
'body': json.dumps({
'message': f'Hello, {name}!'
})
}
Azure Functions
[FunctionName("HttpTrigger")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
return name != null
? (ActionResult)new OkObjectResult($"Hello, {name}")
: new BadRequestObjectResult("Please pass a name on the query string or in the request body");
}
Google Cloud Functions
const functions = require('@google-cloud/functions-framework');
// HTTP function
functions.http('helloHttp', (req, res) => {
const name = req.query.name || 'World';
res.send(`Hello, ${name}!`);
});
// Background function
functions.cloudEvent('helloGcs', (data, context) => {
const filename = data.name;
console.log(`File ${filename} uploaded.`);
});
Cloud Deployment Strategies
Infrastructure as Code (IaC)
IaC allows you to manage and provision infrastructure through code.
AWS CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Simple web application stack'
Resources:
WebAppSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: 'Enable HTTP access'
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
WebAppInstance:
Type: AWS::EC2::Instance
Properties:
InstanceType: t3.micro
ImageId: ami-0c55b159cbfafe1f0
SecurityGroups:
- !Ref WebAppSecurityGroup
Azure Resource Manager (ARM)
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-04-01",
"name": "[uniqueString('storageaccount')]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard_LRS"
},
"kind": "StorageV2"
}
]
}
Google Cloud Deployment Manager
resources:
- name: my-vm
type: compute.v1.instance
properties:
zone: us-central1-a
machineType: zones/us-central1-a/machineTypes/n1-standard-1
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: projects/debian-cloud/global/images/family/debian-9
Cloud Best Practices
Security
- Principle of least privilege: Grant minimum necessary permissions
- Multi-factor authentication: Enable MFA for all accounts
- Encryption: Encrypt data at rest and in transit
- Regular audits: Monitor and review access logs
Cost Optimization
- Right-sizing: Choose appropriate instance sizes
- Reserved instances: Commit to long-term usage for discounts
- Auto-scaling: Scale resources based on demand
- Monitoring: Track and optimize spending
Performance
- CDN usage: Use Content Delivery Networks
- Caching: Implement caching strategies
- Load balancing: Distribute traffic efficiently
- Monitoring: Track performance metrics
Reliability
- Multi-region deployment: Deploy across multiple regions
- Backup and recovery: Implement regular backups
- Health checks: Monitor application health
- Disaster recovery: Plan for failures
Choosing the Right Cloud Provider
Factors to Consider
- Existing investments: Microsoft shops may prefer Azure
- Technical requirements: Specific services needed
- Compliance requirements: Data residency and regulations
- Cost considerations: Pricing models and discounts
- Ecosystem integration: Third-party tools and services
Provider Comparison
| Feature | AWS | Azure | GCP |
|---|---|---|---|
| Market Share | 32% | 23% | 11% |
| Services | 200+ | 100+ | 90+ |
| Regions | 25+ | 60+ | 25+ |
| Pricing | Pay-as-you-go | Flexible | Competitive |
| Documentation | Excellent | Good | Good |
Getting Started
Learning Path
- Choose a provider: Start with one cloud provider
- Free tier: Use free tier for learning
- Certifications: Pursue cloud certifications
- Hands-on practice: Build real projects
- Community: Join cloud computing communities
Common Projects
- Deploy a web application
- Set up a serverless API
- Create a data processing pipeline
- Implement CI/CD pipeline
- Build a microservices architecture