AWS S3 Bucket sicher konfigurieren – Best Practices 2025

Public Access blockieren, Versioning aktivieren und Kosten kontrollieren

S
SeeColors IT
11. Juni 20264 Min. Lesezeit128 Aufrufe

S3 Bucket erstellen und absichern

# Bucket erstellen (Region: eu-central-1 = Frankfurt)
aws s3api create-bucket     --bucket meine-firma-backups     --region eu-central-1     --create-bucket-configuration LocationConstraint=eu-central-1

# KRITISCH: Public Access vollständig blockieren
aws s3api put-public-access-block     --bucket meine-firma-backups     --public-access-block-configuration     BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

# Versioning aktivieren (Schutz vor versehentlichem Löschen)
aws s3api put-bucket-versioning     --bucket meine-firma-backups     --versioning-configuration Status=Enabled

# Verschlüsselung erzwingen (AES-256)
aws s3api put-bucket-encryption     --bucket meine-firma-backups     --server-side-encryption-configuration     '{"Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"AES256"}}]}'

Bucket Policy (Zugriff nur von bestimmten Rollen)

cat > bucket-policy.json << 'EOF'
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::meine-firma-backups",
        "arn:aws:s3:::meine-firma-backups/*"
      ],
      "Condition": {
        "Bool": {"aws:SecureTransport": "false"}
      }
    },
    {
      "Effect": "Allow",
      "Principal": {"AWS": "arn:aws:iam::123456789012:role/backup-role"},
      "Action": ["s3:GetObject","s3:PutObject","s3:ListBucket"],
      "Resource": [
        "arn:aws:s3:::meine-firma-backups",
        "arn:aws:s3:::meine-firma-backups/*"
      ]
    }
  ]
}
EOF

aws s3api put-bucket-policy     --bucket meine-firma-backups     --policy file://bucket-policy.json

Lifecycle-Policies (Kosten optimieren)

cat > lifecycle.json << 'EOF'
{
  "Rules": [
    {
      "ID": "Backups-Rotation",
      "Status": "Enabled",
      "Filter": {"Prefix": "backups/"},
      "Transitions": [
        {"Days": 30, "StorageClass": "STANDARD_IA"},
        {"Days": 90, "StorageClass": "GLACIER"},
        {"Days": 365, "StorageClass": "DEEP_ARCHIVE"}
      ],
      "Expiration": {"Days": 2555}
    }
  ]
}
EOF

aws s3api put-bucket-lifecycle-configuration     --bucket meine-firma-backups     --lifecycle-configuration file://lifecycle.json

S3 Speicherklassen – Kosten

Klasse Kosten (GB/Monat) Zugriff
Standard 0,023 USD Sofort
Standard-IA 0,0125 USD Sofort (+Abruf-Kosten)
Glacier Instant 0,004 USD Sofort
Glacier Flexible 0,0036 USD 3–5 Stunden
Deep Archive 0,00099 USD 12 Stunden

S3 als statische Website

# Statisches Hosting aktivieren
aws s3api put-bucket-website     --bucket meine-website     --website-configuration     '{"IndexDocument":{"Suffix":"index.html"},"ErrorDocument":{"Key":"error.html"}}'

# Dateien hochladen
aws s3 sync ./website-files/ s3://meine-website/ --acl public-read

S3 CLI-Befehle

# Alle Buckets
aws s3 ls

# Bucket-Inhalt
aws s3 ls s3://meine-firma-backups/ --recursive

# Datei hochladen
aws s3 cp backup.tar.gz s3://meine-firma-backups/backups/

# Ordner synchronisieren
aws s3 sync /backup/ s3://meine-firma-backups/backups/

# Datei herunterladen
aws s3 cp s3://meine-firma-backups/backups/backup.tar.gz ./

# Bucket-Größe ermitteln
aws s3 ls s3://meine-firma-backups --recursive --summarize | tail -2

FAQ

Wie erkenne ich einen öffentlich zugänglichen S3 Bucket?
AWS Security Hub und Trusted Advisor prüfen das automatisch. Manuell: Public Access Block konfigurieren und Bucket ACLs prüfen.

Fazit

S3 korrekt konfiguriert (kein Public Access, HTTPS-Pflicht, Versioning) ist eine der sichersten Speicherlösungen der Cloud.

AWS S3 und Cloud-Sicherheit für KMU in Heidelberg, Mannheim und der Rhein-Neckar-Region. Anfragen.

Artikel teilen

War dieser Artikel hilfreich?

Dein Feedback hilft uns, bessere Inhalte zu erstellen.

Kommentar hinterlassen

Verwandte Artikel