Chapter 9. Enabling Cross-origin Resource Sharing

In this chapter, you will learn:

  • Walkthrough 1: Enabling CORS through the S3 console
  • Walkthrough 2: Enabling CORS using AWS CLI

Introduction

Cross-origin resource sharing (CORS) allows client web applications to access your S3 resources in a different domain by defining the CORS configuration in the XML document attached to your bucket. It allows cross-origin requests for your client-side application using CORS. For example, imagine that you have your own web server in the EC2 instance and want to use JavaScript on the web pages to access JSON files in an S3 static website. You can configure your bucket to enable cross-origin requests from the web server.

CORS can define rules in the XML configuration ...

Get Amazon S3 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.