Skip to main content
Gcore CDN can cache and deliver objects from a public Amazon S3 static website endpoint. A private S3 origin is required when objects must not be exposed by a public-read bucket policy.
The public-read policy in this procedure allows anyone to retrieve matching bucket objects. Do not use it for private or sensitive content.
1

Create and populate the S3 bucket

  1. Log in to the AWS Management Console and open Amazon S3.
  2. Create a general purpose bucket and select its AWS Region.
  3. Upload the objects to deliver through the CDN, including index.html and a logo.png verification object.
2

Allow public website access

Account-level Block Public Access settings must permit public bucket policies. If those settings are centrally managed, contact the AWS account administrator before changing the bucket.
  1. Open the bucket and select Permissions.
  2. Under Block public access (bucket settings), click Edit.
  3. Clear Block all public access.
  4. Select I acknowledge that the current settings might result in this bucket and the objects within becoming public.
Block Public Access options cleared with the public-access acknowledgment selected
  1. Click Save changes, then confirm the change in the dialog.
3

Enable static website hosting

  1. Open the bucket’s Properties tab.
  2. Under Static website hosting, click Edit.
  3. Set Static website hosting to Enable.
  4. Set Hosting type to Host a static website.
  5. In Index document, enter index.html or the name of another uploaded default object.
Static website hosting enabled with index.html as the index document
  1. Save the changes and copy the Bucket website endpoint.
Use the endpoint provided by AWS instead of constructing it manually because its format depends on the Region.
4

Add a public-read bucket policy

On the Permissions tab, click Edit under Bucket policy. Replace example-bucket with the bucket name in this policy:
Click Save changes.
5

Test the S3 website endpoint

Append /logo.png to the HTTP website endpoint copied from AWS and open the resulting URL.Confirm that the object loads without a 403 or 404 response. Amazon S3 website endpoints support HTTP but not HTTPS.
6

Create the CDN resource

  1. Log in to the Gcore Customer Portal and select CDN > CDN resources.
  2. Click Create CDN resource.
  3. In Add domain, enter the custom domain.
  4. In Origin, keep Specify content origin selected.
  5. Select URL.
  6. Select HTTP as the origin pull protocol.
  7. In Origin source, enter the S3 website endpoint without http:// and without an object path.
  8. Click Create.
The resource may initially have the Processing status. Wait until its status changes to Active before testing delivery.
7

Configure the custom domain

  1. Configure the custom domain by pointing its CNAME record to the *.gcdn.co hostname shown in the CDN resource’s Setup guide.
  2. For HTTPS delivery, attach an SSL certificate to the custom domain.
8

Test delivery through the CDN

  1. Open the verification object through the custom CDN domain:
  2. Confirm that the object loads.
  3. (Optional) Configure the application to use the CDN domain, then use the browser’s Network panel to confirm that asset requests use that domain. Creating a CDN resource does not rewrite asset URLs in HTML or application code.