Storage
Block Storage
storage volumes block
Übersicht
STACKIT Block Storage bietet persistente, hochperformante Block-Speicher-Volumes für virtuelle Maschinen. Die Volumes können dynamisch an VMs angehängt und wieder getrennt werden, ohne Datenverlust. Mit verschiedenen Performance-Tiers können Sie die richtige Balance zwischen IOPS, Durchsatz und Kosten wählen. Snapshots ermöglichen Point-in-Time-Backups und schnelle Wiederherstellung. Block Storage ist perfekt für Datenbanken, Anwendungen mit hohen I/O-Anforderungen und persistente Datenspeicherung für containerisierte Workloads.
Go SDK Beispiel
package main
import (
"context"
"fmt"
"github.com/stackitcloud/stackit-sdk-go/services/storage"
)
func main() {
// Initialize Storage client
client, err := storage.NewClient()
if err != nil {
panic(err)
}
// Create a new volume
volume, err := client.CreateVolume(context.Background(), &storage.CreateVolumeRequest{
ProjectID: "your-project-id",
Name: "my-volume",
SizeGB: 100,
PerformanceTier: "high-iops",
AvailabilityZone: "eu01-1",
})
if err != nil {
panic(err)
}
fmt.Printf("Volume created: %s (%d GB)\n", volume.Name, volume.SizeGB)
// Attach volume to a VM
err = client.AttachVolume(context.Background(), &storage.AttachVolumeRequest{
VolumeID: volume.ID,
ServerID: "your-server-id",
})
if err != nil {
panic(err)
}
fmt.Println("Volume attached to VM")
}