class S3Origin
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.CloudFront.Origins.S3Origin |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfrontorigins#S3Origin |
Java | software.amazon.awscdk.services.cloudfront.origins.S3Origin |
Python | aws_cdk.aws_cloudfront_origins.S3Origin |
TypeScript (source) | aws-cdk-lib » aws_cloudfront_origins » S3Origin |
⚠️ Deprecated: Use S3BucketOrigin or S3StaticWebsiteOrigin instead.
Implements
IOrigin
An Origin that is backed by an S3 bucket.
If the bucket is configured for website hosting, this origin will be configured to use the bucket as an HTTP server origin and will use the bucket's configured website redirects and error handling. Otherwise, the origin is created as a bucket origin and will use CloudFront's redirect and error handling.
Example
// Add a cloudfront Function to a Distribution
const cfFunction = new cloudfront.Function(this, 'Function', {
code: cloudfront.FunctionCode.fromInline('function handler(event) { return event.request }'),
runtime: cloudfront.FunctionRuntime.JS_2_0,
});
declare const s3Bucket: s3.Bucket;
new cloudfront.Distribution(this, 'distro', {
defaultBehavior: {
origin: new origins.S3Origin(s3Bucket),
functionAssociations: [{
function: cfFunction,
eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
}],
},
});
Initializer
new S3Origin(bucket: IBucket, props?: S3OriginProps)
⚠️ Deprecated: Use S3BucketOrigin or S3StaticWebsiteOrigin instead.
Parameters
- bucket
IBucket - props
S3Origin Props
Methods
| Name | Description |
|---|---|
| bind(scope, options) | The method called when a given Origin is added (for the first time) to a Distribution. |
bind(scope, options)
public bind(scope: Construct, options: OriginBindOptions): OriginBindConfig
⚠️ Deprecated: Use S3BucketOrigin or S3StaticWebsiteOrigin instead.
Parameters
- scope
Construct - options
OriginBind Options
Returns
The method called when a given Origin is added (for the first time) to a Distribution.

.NET
Go
Java
Python
TypeScript (