class S3BucketOrigin
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudFront.Origins.S3BucketOrigin |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfrontorigins#S3BucketOrigin |
Java | software.amazon.awscdk.services.cloudfront.origins.S3BucketOrigin |
Python | aws_cdk.aws_cloudfront_origins.S3BucketOrigin |
TypeScript (source) | aws-cdk-lib » aws_cloudfront_origins » S3BucketOrigin |
Implements
IOrigin
Extends
Origin
A S3 Bucket Origin.
Example
const myBucket = new s3.Bucket(this, 'myBucket');
new cloudfront.Distribution(this, 'myDist', {
defaultBehavior: {
origin: new origins.OriginGroup({
primaryOrigin: origins.S3BucketOrigin.withOriginAccessControl(myBucket),
fallbackOrigin: new origins.HttpOrigin('www.example.com'),
// optional, defaults to: 500, 502, 503 and 504
fallbackStatusCodes: [404],
}),
},
});
Initializer
new S3BucketOrigin(bucket: IBucket, props?: S3BucketOriginBaseProps)
Parameters
- bucket
IBucket
- props
S3
Bucket Origin Base Props
Methods
Name | Description |
---|---|
bind(_scope, options) | Binds the origin to the associated Distribution. |
protected render | |
static with | Create a S3 Origin with default S3 bucket settings (no origin access control). |
static with | Create a S3 Origin with Origin Access Control (OAC) configured. |
static with | Create a S3 Origin with Origin Access Identity (OAI) configured OAI is a legacy feature and we strongly recommend you to use OAC via withOriginAccessControl() unless it is not supported in your required region (e.g. China regions). |
bind(_scope, options)
public bind(_scope: Construct, options: OriginBindOptions): OriginBindConfig
Parameters
- _scope
Construct
- options
Origin
Bind Options
Returns
Binds the origin to the associated Distribution.
Can be used to grant permissions, create dependent resources, etc.
S3OriginConfig()
protected renderprotected renderS3OriginConfig(): S3OriginConfigProperty
Returns
BucketDefaults(bucket, props?)
static withpublic static withBucketDefaults(bucket: IBucket, props?: OriginProps): IOrigin
Parameters
- bucket
IBucket
- props
Origin
Props
Returns
Create a S3 Origin with default S3 bucket settings (no origin access control).
OriginAccessControl(bucket, props?)
static withpublic static withOriginAccessControl(bucket: IBucket, props?: S3BucketOriginWithOACProps): IOrigin
Parameters
- bucket
IBucket
- props
S3
Bucket Origin With OACProps
Returns
Create a S3 Origin with Origin Access Control (OAC) configured.
OriginAccessIdentity(bucket, props?)
static withpublic static withOriginAccessIdentity(bucket: IBucket, props?: S3BucketOriginWithOAIProps): IOrigin
Parameters
- bucket
IBucket
- props
S3
Bucket Origin With OAIProps
Returns
Create a S3 Origin with Origin Access Identity (OAI) configured OAI is a legacy feature and we strongly recommend you to use OAC via withOriginAccessControl()
unless it is not supported in your required region (e.g. China regions).