Available in Classic and VPC
Register Cross-Origin Resource Sharing (CORS) settings for an Ncloud Storage bucket or overwrite existing settings.
Commands
The command statement is as follows:
aws s3api put-bucket-cors --bucket <value> --cors-configuration <value> [--options]
Parameter
The following describes the parameters.
| Parameter | Type | Required | Description | Restrictions |
|---|---|---|---|---|
| --bucket <value> | string | Y | Bucket name | - |
| --cors-configuration <value> | string | Y | CORS settings. Specify rules by including them in the CORSRules list. |
Up to 100 rules can be set. |
| --endpoint-url <value> | string | Y | Specify the default URL for command calls. | It is only available for the KR Region. See Ncloud Storage overview for call domain information. |
| --cli-input-json | --cli-input-yaml | string | N | Enter arguments from the provided json or yaml string. | You can't specify json and yaml together. |
| --generate-cli-skeleton <value> | integer | N | Create a parameter template that can be used as input later without executing the API command. | - |
| --debug | boolean | N | Use debug logging. | - |
| --no-verify-ssl | boolean | N | Redefine the default behavior for validating SSL certificates. | - |
| --no-paginate | boolean | N | Disable automatic pagination, call only the first page for results. | - |
| --output <value> | string | N | Specify the format of response results. | Available options
|
| --query <value> | string | N | JMESPath query to use for filtering response data | - |
| --profile <value> | string | N | Use a specific profile in the credentials file. | - |
| --region <value> | string | N | Specify the Region. | Only KR is supported. |
| --color <value> | string | N | Set output color. | Available options
|
| --no-sign-request | boolean | N | Disable credential loading. | - |
| --ca-bundle <value> | string | N | Specify the CA certificate to use when verifying SSL certificates. | - |
| --cli-read-timeout <value> | int | N | Maximum read time; entering 0 changes it to a blocked status instead of a timeout. | It is set to 60 seconds by default. |
| --cli-connect-timeout <value> | int | N | Maximum connection time; entering 0 changes it to a blocked status instead of a timeout. | It is set to 60 seconds by default. |
| --no-cli-pager | boolean | N | Disable the CLI pager for response values. | - |
| --cli-auto-prompt | boolean | N | Enable automatic prompting for CLI input parameters. | - |
| --no-cli-auto-prompt | boolean | N | Disable automatic prompting for CLI input parameters. | - |
Permissions
If a sub account user wants to use this command, they need the Change/PutBucketCORS action permission.
Examples
This section describes an example of calling and responding to the put-bucket-cors command.
Register CORS settings
Call examples
This is an example of registering a CORS rule that allows GET and PUT methods from the https://example.com origin. The following is a call example.
aws s3api put-bucket-cors --endpoint-url=http://kr.ncloudstorage.com --bucket test1 --cors-configuration '{"CORSRules":[{"ID":"rule1","AllowedMethods":["GET","PUT"],"AllowedOrigins":["https://example.com"],"AllowedHeaders":["*"],"ExposeHeaders":["x-amz-server-side-encryption"],"MaxAgeSeconds":3600}]}'
Related commands
Related commands are as follows: