Tạo CloudFront Distribution

Tạo CloudFront Distribution

Trong bước này, bạn tạo một CloudFront distribution sử dụng S3 bucket ở bước 2.3 làm origin. Bucket vẫn ở chế độ private, CloudFront được cấp quyền đọc thông qua bucket policy do console tự động tạo.

  1. Mở CloudFront console tại https://console.aws.amazon.com/cloudfront/

    • Chọn Distributions
    • Chọn Create distribution

Create CloudFront Distribution

  1. Mở S3 console và chọn bucket đã tạo ở bước 2.3.
    • Chọn checkbox bên cạnh index.html
    • Chọn Copy URL

Create CloudFront Distribution

  1. Quay lại tab CloudFront. Tại trang Get started, trong phần Distribution options:

    • Distribution name: dán URL vừa sao chép, sau đó xóa https:// ở đầu và /index.html ở cuối. Tên sẽ có dạng cloudfront-lab-<account-id>-<region>-an.s3.<region>.amazonaws.com
    • Description: để trống
    • Distribution type: chọn Single website configuration
    • Để trống phần Domain, cuộn xuống và chọn Next

Create CloudFront Distribution

Distribution name chỉ là tag giúp bạn nhận diện distribution. Bạn có thể thay đổi sau.

  1. Chọn Browse S3

Create CloudFront Distribution

  1. Trong hộp thoại Select S3 location, chọn bucket rồi chọn Choose.

Create CloudFront Distribution

  1. Trong phần Settings, cấu hình như hình bên dưới

Create CloudFront Distribution

  1. Chọn Do not enable security protections, sau đó chọn Next.

Create CloudFront Distribution

  1. Tại trang Review and create, kiểm tra lại các thiết lập. Chọn Create distribution.

Create CloudFront Distribution

  1. Distribution đã được tạo.

Create CloudFront Distribution

  1. Tại tab General, trong phần Settings, chọn Edit.

Create CloudFront Distribution

  1. Tại Default root object, nhập index.html, sau đó cuộn xuống và chọn Save changes.

Create CloudFront Distribution