aws-cdk-lib.aws_s3.CfnBucket.CorsRuleProperty

interface CorsRuleProperty

LanguageType name
.NETAmazon.CDK.AWS.S3.CfnBucket.CorsRuleProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awss3#CfnBucket_CorsRuleProperty
Javasoftware.amazon.awscdk.services.s3.CfnBucket.CorsRuleProperty
Pythonaws_cdk.aws_s3.CfnBucket.CorsRuleProperty
TypeScript aws-cdk-lib » aws_s3 » CfnBucket » CorsRuleProperty

Specifies a cross-origin access rule for an Amazon S3 bucket.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';
const corsRuleProperty: s3.CfnBucket.CorsRuleProperty = {
  allowedMethods: ['allowedMethods'],
  allowedOrigins: ['allowedOrigins'],

  // the properties below are optional
  allowedHeaders: ['allowedHeaders'],
  exposedHeaders: ['exposedHeaders'],
  id: 'id',
  maxAge: 123,
};

Properties

NameTypeDescription
allowedMethodsstring[]An HTTP method that you allow the origin to run.
allowedOriginsstring[]One or more origins you want customers to be able to access the bucket from.
allowedHeaders?string[]Headers that are specified in the Access-Control-Request-Headers header.
exposedHeaders?string[]One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript XMLHttpRequest object).
id?stringA unique identifier for this rule.
maxAge?numberThe time in seconds that your browser is to cache the preflight response for the specified resource.

allowedMethods

Type: string[]

An HTTP method that you allow the origin to run.

Allowed values : GET | PUT | HEAD | POST | DELETE


allowedOrigins

Type: string[]

One or more origins you want customers to be able to access the bucket from.


allowedHeaders?

Type: string[] (optional)

Headers that are specified in the Access-Control-Request-Headers header.

These headers are allowed in a preflight OPTIONS request. In response to any preflight OPTIONS request, Amazon S3 returns any requested headers that are allowed.


exposedHeaders?

Type: string[] (optional)

One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript XMLHttpRequest object).


id?

Type: string (optional)

A unique identifier for this rule.

The value must be no more than 255 characters.


maxAge?

Type: number (optional)

The time in seconds that your browser is to cache the preflight response for the specified resource.