Загрузка...

Introduction to Amazon CloudFront

Introduction to Amazon CloudFront

Task 1: Create an S3 Bucket

Go to Services -- S3 -- Create Bucket
Enter a bucket name, select ACLs enabled and Object writer then disable Block all public access. Click Create bucket.

Task 2: Upload a File to S3

Open the bucket and click Upload -- Add files. Select an image from your computer and upload it. Once completed, the file will appear in the bucket.

Task 3: Create Custom Error Pages

Inside the bucket, create a folder named CustomErrors. Enable the specified encryption key and create the folder.

Create two HTML files using Notepad:

error.html for CloudFront error messages
block.html for geographic restriction messages

Upload both files into the folder.

Task 4: Make Objects Public

Open the image’s Object URL. If AccessDenied appears, go to Permissions -- Bucket Policy -- Edit and paste the provided policy. Save the changes and refresh the URL. If the image loads, the object is now public.

Task 5: Create a CloudFront Distribution

Go to CloudFront -- Create Distribution. Under Origin Domain Name choose your S3 bucket. Select Do not enable (WAF)and keep other settings as default. Click Create distribution.

Task6: Access the Image Through CloudFront

Copy the CloudFront domain name and add the image name to the end of the URL. Open it in a browser to view the image. CloudFront delivers content faster by routing users to the nearest edge location.

Task 7: Configure a Custom Error Page

In CloudFront, select the distribution and open the Error Pages tab. Click Create custom error response and configure:

HTTP Error Code: 404
Error Caching TTL: 10
Customize Error Response: Yes
Response Page Path: `/CustomErrors/error.html`

Save the settings and wait until the status changes to Deployed. Test it by entering a non-existing image URL; the custom error page should appear.

Task 8: Restrict Geographic Access

Go to Security -- Geographic Restrictions -- Edit. Set:

Restriction Type: Block List
Select your country

Save the changes and wait until the distribution is deployed.

Then create another custom error response for blocked access:

HTTP Error Code: 403
Error Caching TTL: 10
Response Page Path: `/CustomErrors/block.html`

After deployment, users from restricted countries will see the custom block page.

Видео Introduction to Amazon CloudFront канала Simply The Baimz
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять