0Pricing
AWS for Backend Developers (EC2, S3, RDS, Lambda) · Pelajaran

Meng-host Situs Web Statis dan Pengiriman CDN

Sajikan situs web statis langsung dari bucket S3 dan percepat pengiriman global dengan CDN CloudFront di depannya.

Meng-host Situs Web Statis dan Pengiriman CDN adalah pelajaran AWS for Backend Developers (EC2, S3, RDS, Lambda) gratis di CoddyKit. Ini adalah pelajaran 4 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar AWS for Backend Developers (EC2, S3, RDS, Lambda), dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus AWS for Backend Developers (EC2, S3, RDS, Lambda) mencakup 4 pelajaran total.

Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

S3 as a Web Server

Beyond storing files, S3 can host a static website, HTML, CSS, JS, and images, with no servers to manage. It is cheap, scalable, and a perfect fit for single-page apps and documentation sites.

Enabling Static Hosting

You enable the static website hosting feature on the bucket and specify an index document (the home page) and an error document.

Index and Error Documents

The index document (often index.html) is served for the root and folder URLs. The error document handles 4xx responses, useful for SPA routing where you point errors back to index.html.

Uploading Your Site

Sync your build output into the bucket. The AWS CLI sync command uploads only changed files.

aws s3 sync ./dist s3://my-site-bucket --delete

Content Types Matter

S3 serves files with the Content-Type stored as metadata. If a CSS file is served as plain text, browsers ignore it. The CLI usually infers types, but verify for unusual extensions.

The Website Endpoint

Static hosting exposes a regional website endpoint URL. It is HTTP only and not ideal for production, which is exactly why we add a CDN next.

http://my-site-bucket.s3-website-us-east-1.amazonaws.com

Introducing CloudFront

CloudFront is AWS's content delivery network. It caches your site at edge locations worldwide, so users get fast responses from a nearby server and your bucket sees less load.

Origins and Distributions

A CloudFront distribution points at an origin (your S3 bucket). CloudFront fetches from the origin on a cache miss and serves the cached copy on subsequent requests.

HTTPS and Custom Domains

CloudFront gives you free HTTPS via AWS Certificate Manager and lets you attach a custom domain like www.example.com, things the raw S3 endpoint cannot do.

Locking Down the Bucket

For security, keep the bucket private and let only CloudFront read it using an Origin Access Control (OAC). Visitors reach content through the CDN, never the bucket directly.

Cache Invalidation

CloudFront caches aggressively. After deploying new content, invalidate the cache so users get the latest version instead of a stale copy.

aws cloudfront create-invalidation \
  --distribution-id E123ABC \
  --paths "/*"

Quick Check

Test your static hosting knowledge.

Recap: Global Static Sites

You can now ship a static site on AWS:

  • Enable S3 static website hosting with index/error documents.
  • aws s3 sync deploys your build.
  • CloudFront adds edge caching, HTTPS, and custom domains.
  • Use OAC to keep the bucket private and invalidate the cache on deploy.

Pertanyaan yang Sering Diajukan

Apakah pelajaran “Meng-host Situs Web Statis dan Pengiriman CDN” gratis?

Ya — teks lengkap “Meng-host Situs Web Statis dan Pengiriman CDN” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus AWS for Backend Developers (EC2, S3, RDS, Lambda), upgrade ke CoddyKit PRO. Kursus AWS for Backend Developers (EC2, S3, RDS, Lambda) mencakup 4 pelajaran total.

Apa yang akan aku pelajari di “Meng-host Situs Web Statis dan Pengiriman CDN”?

Sajikan situs web statis langsung dari bucket S3 dan percepat pengiriman global dengan CDN CloudFront di depannya. Kamu berlatih AWS for Backend Developers (EC2, S3, RDS, Lambda) dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.

Apakah aku perlu pengalaman untuk memulai AWS for Backend Developers (EC2, S3, RDS, Lambda)?

Tidak diperlukan pengalaman sebelumnya. AWS for Backend Developers (EC2, S3, RDS, Lambda) di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 4 dari 4.

Berapa lama pelajaran “Meng-host Situs Web Statis dan Pengiriman CDN” memakan waktu?

Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.

Bisakah aku menulis dan menjalankan kode dalam pelajaran AWS for Backend Developers (EC2, S3, RDS, Lambda) ini?

Ya. Setiap pelajaran AWS for Backend Developers (EC2, S3, RDS, Lambda) menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.

Semua pelajaran dalam kursus ini

  1. Penjelasan Bucket dan Objek S3
  2. Pembuatan Versi dan Kebijakan Siklus Hidup S3
  3. Mengamankan Akses Data S3
  4. Meng-host Situs Web Statis dan Pengiriman CDN
← Kembali ke AWS for Backend Developers (EC2, S3, RDS, Lambda)