aws-cdk-lib.aws_cloudfront_origins.OriginGroup

class OriginGroup

LanguageType name
.NETAmazon.CDK.AWS.CloudFront.Origins.OriginGroup
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudfrontorigins#OriginGroup
Javasoftware.amazon.awscdk.services.cloudfront.origins.OriginGroup
Pythonaws_cdk.aws_cloudfront_origins.OriginGroup
TypeScript (source)aws-cdk-lib » aws_cloudfront_origins » OriginGroup

Implements IOrigin

An Origin that represents a group.

Consists of a primary Origin, and a fallback Origin called when the primary returns one of the provided HTTP status codes.

Example

const myBucket = new s3.Bucket(this, 'myBucket');
new cloudfront.Distribution(this, 'myDist', {
  defaultBehavior: {
    origin: new origins.OriginGroup({
      primaryOrigin: new origins.S3Origin(myBucket),
      fallbackOrigin: new origins.HttpOrigin('www.example.com'),
      // optional, defaults to: 500, 502, 503 and 504
      fallbackStatusCodes: [404],
    }),
  },
});

Initializer

new OriginGroup(props: OriginGroupProps)

Parameters

  • props OriginGroupProps

Methods

NameDescription
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

Parameters

  • scope Construct
  • options OriginBindOptions

Returns

  • OriginBindConfig

The method called when a given Origin is added (for the first time) to a Distribution.