AWS Solutions Architect – CORS

CORS

A topic that could come up in your Solutions Architect exams that is easy to overlook is CORS. This stands for Cross-Origin Resource Sharing. It is a way that you can have your client web applications that exist in one domain (for example, website.s3-website-us-east-1.amazonaws.com) to access resources in a different domain (website.s3.amazonaws.com). This feature ties directly to Amazon S3 (Simple Storage Service).

As you might guess, you can enable CORS support using the Management Console, the CLI, or your SDKs.

What would be some sample use cases?

  • You have JavaScript calls on web pages from an S3 bucket that need to access an API endpoint with a different domain name
  • You are hosting a Web site in your S3 bucket that includes web fonts; CORS is required by client browsers in this case

To configure your bucket to allow cross-origin requests you create a CORS configuration that is an XML document. The XML document contains rules that identify the origins that you will allow to access your bucket, the operations (HTTP methods) will support for each origin, and other operation-specific information

You can add up to 100 rules to the configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *