aws-cdk-lib.aws_s3.RoutingRuleCondition

interface RoutingRuleCondition

LanguageType name
.NETAmazon.CDK.AWS.S3.RoutingRuleCondition
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awss3#RoutingRuleCondition
Javasoftware.amazon.awscdk.services.s3.RoutingRuleCondition
Pythonaws_cdk.aws_s3.RoutingRuleCondition
TypeScript (source)aws-cdk-lib » aws_s3 » RoutingRuleCondition

Example

const bucket = new s3.Bucket(this, 'MyRedirectedBucket', {
  websiteRoutingRules: [
    {
      hostName: 'www.example.com',
      httpRedirectCode: '302',
      protocol: s3.RedirectProtocol.HTTPS,
      replaceKey: s3.ReplaceKey.prefixWith('test/'),
      condition: {
        httpErrorCodeReturnedEquals: '200',
        keyPrefixEquals: 'prefix',
      },
    },
  ],
});

Properties

NameTypeDescription
httpErrorCodeReturnedEquals?stringThe HTTP error code when the redirect is applied.
keyPrefixEquals?stringThe object key name prefix when the redirect is applied.

httpErrorCodeReturnedEquals?

Type: string (optional, default: The HTTP error code will not be verified)

The HTTP error code when the redirect is applied.

In the event of an error, if the error code equals this value, then the specified redirect is applied.

If both condition properties are specified, both must be true for the redirect to be applied.


keyPrefixEquals?

Type: string (optional, default: The object key name will not be verified)

The object key name prefix when the redirect is applied.

If both condition properties are specified, both must be true for the redirect to be applied.