Adding a CORS policy to a container
This section explains how to add a cross-origin resource sharing (CORS) configuration to an AWS Elemental MediaStore container. CORS allows client web applications that are loaded in one domain to interact with resources in another domain.
To configure your container to allow cross-origin requests, you add a CORS policy to the container. A CORS policy defines rules that identify the origins that you allow to access your container, the operations (HTTP methods) supported for each origin, and other operation-specific information.
When you add a CORS policy to the container, the container policies (that govern access rights to the container) continue to apply.
To add a CORS policy (console)
Open the MediaStore console at https://console.aws.amazon.com/mediastore/
. -
On the Containers page, choose the name of the container that you want to create a CORS policy for.
The container details page appears.
-
In the Container CORS policy section, choose Create CORS policy.
-
Insert the policy in JSON format, and then choose Save.
To add a CORS policy (AWS CLI)
-
Create a file that defines the CORS policy:
[ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET", "HEAD" ], "AllowedOrigins": [ "*" ], "MaxAgeSeconds": 3000 } ]
-
In the AWS CLI, use the
put-cors-policy
command.aws mediastore put-cors-policy --container-name
ExampleContainer
--cors-policy file://corsPolicy.json
--regionus-west-2
This command has no return value.