Provides virtualized computing resources over the internet. Users can rent virtual machines, storage, and networks, gaining control over operating systems and applications without managing physical hardware.
# Examples
• **Amazon Web Services (AWS):** Offers services like Amazon EC2 for scalable computing capacity and Amazon S3 for storage solutions.
• **Microsoft Azure:** Provides virtual machines and storage solutions for various applications.
• **Google Compute Engine (GCE):** Delivers virtual machines running in Google’s data centers.
# APIs
APIs allow users to programmatically manage virtual machines, storage, and networking components. For instance, developers can use APIs to provision or decommission servers, adjust network settings, or manage storage allocations within platforms like Amazon Web Services (AWS) or Microsoft Azure.
## Google Example
To illustrate how APIs interact with different cloud service models within Google Cloud—Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS)—here are examples demonstrating API usage for each:
**Infrastructure as a Service (IaaS)**
Google Cloud’s Compute Engine allows for the management of virtual machine instances. Using the Google Cloud Client Libraries, you can interact with these services programmatically. Below is a Python example that lists all Compute Engine instances in a project:
```python
from google.cloud import compute_v1
def list_instances(project_id, zone):
instance_client = compute_v1.InstancesClient()
instances = instance_client.list(project=project_id, zone=zone)
for instance in instances:
print(f"Instance name: {instance.name}")
# Replace 'your-project-id' and 'your-zone' with appropriate values
list_instances('your-project-id', 'your-zone')
```
This script utilizes the Compute Engine API to retrieve and display the names of all virtual machine instances within a specified project and zone.
## Docker and Kubernetes
IaaS provides virtualized computing resources over the internet. Docker containers can be deployed on virtual machines provided by IaaS platforms, and Kubernetes can manage these containers across a cluster of virtual machines. For instance, Google Compute Engine (GCE) offers virtual machines where you can run Docker containers and manage them using Kubernetes.